Java Code Examples for org.jdesktop.swingx.JXErrorPane

The following examples show how to use org.jdesktop.swingx.JXErrorPane. These examples are extracted from open source projects. 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 Project: cuba   Source File: DesktopWindowManager.java    License: 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 Project: cuba   Source File: DefaultExceptionHandler.java    License: 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 Project: Pixelitor   Source File: Dialogs.java    License: 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 Project: nextreports-designer   Source File: SourceDialog.java    License: 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 Project: nextreports-designer   Source File: Show.java    License: 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));
        }
    });
}