Example usage for javax.swing JDialog setResizable

List of usage examples for javax.swing JDialog setResizable

Introduction

In this page you can find the example usage for javax.swing JDialog setResizable.

Prototype

public void setResizable(boolean resizable) 

Source Link

Document

Sets whether this dialog is resizable by the user.

Usage

From source file:savant.format.SavantFileFormatter.java

public static void reportFormattingError(final Throwable x, final File inFile) {
    if (x instanceof InterruptedException) {
        DialogUtils.displayMessage("Format cancelled.");
    } else if (x instanceof SavantFileFormattingException) {
        // Not a Savant error.  They've just chosen the wrong kind of file.
        DialogUtils.displayMessage("Format Unsuccessful", x.getMessage());
    } else {/*from   www .  ja  v  a  2s  . c o m*/
        JideOptionPane optionPane = new JideOptionPane(String.format(
                "<html>Message: <i>%s</i><br><br>Click the <i>Details</i> button to see more information...<br><br>"
                        + "Please report any issues you experience to the to the development team.</html>",
                MiscUtils.getMessage(x)), JOptionPane.ERROR_MESSAGE, JideOptionPane.CLOSE_OPTION);
        optionPane.setTitle("A problem was encountered while formatting.");
        optionPane.setOptions(new String[] {});
        JButton reportButton = new JButton("Report Issue");
        ((JComponent) optionPane.getComponent(optionPane.getComponentCount() - 1)).add(reportButton);
        final JDialog dialog = optionPane.createDialog(DialogUtils.getMainWindow(), "Format Unsuccessful");
        dialog.setModal(true);
        dialog.setResizable(true);
        optionPane.setDetails(MiscUtils.getStackTrace(x));
        //optionPane.setDetailsVisible(true);
        dialog.pack();

        reportButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e2) {
                String issue = "I am having trouble formatting my file for use with Savant.\nI have provided additional diagnostic information below.\n\n";

                issue += "SOURCE OF FILE: [e.g. UCSC]\n\n";
                issue += "TYPE: [e.g. BED]\n\n";
                issue += "CONTENTS: [e.g. human genes]\n\n";
                issue += "PATH: " + inFile + "\n\n";
                issue += "ADDITIONAL COMMENTS:\n\n";

                dialog.dispose();
                new BugReportDialog(Savant.getInstance(), issue).setVisible(true);
            }

        });

        dialog.setVisible(true);
    }
}