org.jdesktop.swingx.JXErrorPane Java Examples

The following examples show how to use org.jdesktop.swingx.JXErrorPane. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesktopWindowManager.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void showExceptionDialog(Throwable throwable, @Nullable String caption, @Nullable String message) {
    Preconditions.checkNotNullArgument(throwable);

    JXErrorPane errorPane = new JXErrorPaneExt();
    errorPane.setErrorInfo(createErrorInfo(caption, message, throwable));

    final TopLevelFrame mainFrame = App.getInstance().getMainFrame();

    JDialog dialog = JXErrorPane.createDialog(mainFrame, errorPane);
    dialog.setMinimumSize(new Dimension(600, (int) dialog.getMinimumSize().getHeight()));

    final DialogWindow lastDialogWindow = getLastDialogWindow();
    dialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            if (lastDialogWindow != null) {
                lastDialogWindow.enableWindow();
            } else {
                mainFrame.activate();
            }
        }
    });
    dialog.setModal(false);

    if (lastDialogWindow != null) {
        lastDialogWindow.disableWindow(null);
    } else {
        mainFrame.deactivate(null);
    }

    dialog.setVisible(true);
}
 
Example #2
Source File: DefaultExceptionHandler.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public boolean handle(Thread thread, Throwable exception) {
    JXErrorPane errorPane = new JXErrorPaneExt();

    errorPane.setErrorInfo(createErrorInfo(exception));
    JDialog dialog = JXErrorPane.createDialog(App.getInstance().getMainFrame(), errorPane);
    dialog.setMinimumSize(new Dimension(600, (int) dialog.getMinimumSize().getHeight()));

    final DialogWindow lastDialogWindow = getLastDialogWindow();
    dialog.addWindowListener(
            new WindowAdapter() {
                @Override
                public void windowClosed(WindowEvent e) {
                    if (lastDialogWindow != null)
                        lastDialogWindow.enableWindow();
                    else
                        App.getInstance().getMainFrame().activate();
                }
            }
    );
    dialog.setModal(false);

    if (lastDialogWindow != null)
        lastDialogWindow.disableWindow(null);
    else
        App.getInstance().getMainFrame().deactivate(null);

    dialog.setVisible(true);
    return true;
}
 
Example #3
Source File: Dialogs.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
public static void showExceptionDialog(Throwable e, Thread srcThread) {
    if (calledOutsideEDT()) {
        System.err.printf("ERROR: Dialogs.showExceptionDialog called on %s%n", threadName());

        // call this method on the EDT
        Throwable finalE = e;
        EventQueue.invokeLater(() -> showExceptionDialog(finalE, srcThread));
        return;
    }

    System.err.printf("%nDialogs.showExceptionDialog: Exception in the thread '%s'%n",
        srcThread.getName());
    e.printStackTrace();

    RandomGUITest.stop();

    if (e instanceof OutOfMemoryError) {
        showOutOfMemoryDialog((OutOfMemoryError) e);
        return;
    }

    showMoreDevelopmentInfo(e);

    if (e instanceof CompletionException) {
        e = e.getCause();
    }
    if (e instanceof UncheckedIOException) {
        e = e.getCause();
    }
    if (e instanceof InvocationTargetException) {
        e = e.getCause();
    }

    Frame parent = getParent();
    String basicErrorMessage = "An exception occurred: " + e.getMessage();
    var errorInfo = new ErrorInfo("Program error",
        basicErrorMessage, null, null, e,
        Level.SEVERE, null);
    JXErrorPane.showDialog(parent, errorInfo);
}
 
Example #4
Source File: SourceDialog.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
private void ok() {
        if (editorPanel.getText().trim().equals("")) {
            Show.info(I18NSupport.getString("source.dialog.enter.select"));
        } else {
//            if (!testSelect(editorPanel.getText())) {
//                String m = I18NSupport.getString("source.dialog.valid");
//               Show.info(m + " : \"select <exp1> , <exp2> from ...\"");
//            } else {

            try {
                types = ReportLayoutUtil.getAllColumnTypesForReport(editorPanel.getText());
                if (types.size() > 2) {
                    String m = I18NSupport.getString("source.dialog.valid");
                    Show.info(m + " : \"select <exp1> , <exp2> from ...\"");
                } else {
                    okPressed = true;
                    setVisible(false);
                }
            } catch (Exception e) {

                JXErrorPane.showDialog(this, new ErrorInfo(I18NSupport.getString("source.dialog.execute"),
                        I18NSupport.getString("source.dialog.execute"),
                        null, null, e, null, null));
                okPressed = false;
            }
//            }
        }
    }
 
Example #5
Source File: Show.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public static void error(final Component parent, final String message, final Exception e) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JXErrorPane.showDialog(parent, new ErrorInfo(null, message,
                            null, null, e, Level.SEVERE, null));
        }
    });
}