Java Code Examples for javax.swing.JOptionPane.PLAIN_MESSAGE

The following are Jave code examples for showing how to use PLAIN_MESSAGE of the javax.swing.JOptionPane class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: Terminal.java   View Source Code Vote up 6 votes
public void actionPerformed(ActionEvent e) {
    if (!isEnabled())
        return;

    TermOptions clonedTermOptions = termOptions.makeCopy();
    TermOptionsPanel subPanel = new TermOptionsPanel();
    subPanel.setTermOptions(clonedTermOptions);

    JOptionPane optionPane = new JOptionPane(subPanel,
                                             JOptionPane.PLAIN_MESSAGE,
                                             JOptionPane.OK_CANCEL_OPTION
                                             );
        JDialog dialog = optionPane.createDialog(Terminal.this,
                                                 "NBTerm Options");
        dialog.setVisible(true);      // WILL BLOCK!

        if (optionPane.getValue() == null)
            return;     // was closed at the window level

        switch ((Integer) optionPane.getValue()) {
            case JOptionPane.OK_OPTION:
                System.out.printf("Dialog returned OK\n");
                termOptions.assign(clonedTermOptions);
                applyTermOptions(false);
                termOptions.storeTo(prefs);
                break;
            case JOptionPane.CANCEL_OPTION:
                System.out.printf("Dialog returned CANCEL\n");
                break;
            case JOptionPane.CLOSED_OPTION:
                System.out.printf("Dialog returned CLOSED\n");
                break;
            default:
                System.out.printf("Dialog returned OTHER: %s\n",
                                  optionPane.getValue());
                break;
        }
}
 
Example 2
Project: JavaGraph   File: FormulaDialog.java   View Source Code Vote up 6 votes
/**
 * Creates and returns a fresh dialog for the given frame.
 */
private JDialog createDialog(Component frame) {
    Object[] buttons = new Object[] {getOkButton(), getCancelButton()};
    JPanel input = new JPanel();
    input.setLayout(new BorderLayout());
    input.add(getChoiceBox(), BorderLayout.NORTH);
    // add an error label if there is a parser
    if (this.parsed) {
        JPanel errorPanel = new JPanel(new BorderLayout());
        errorPanel.add(getErrorLabel());
        input.add(errorPanel, BorderLayout.SOUTH);
    }
    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.add(input, BorderLayout.CENTER);
    if (this.parsed) {
        main.add(createSyntaxPanel(), BorderLayout.EAST);
    }
    JOptionPane panel = new JOptionPane(main, JOptionPane.PLAIN_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION, null, buttons);
    JDialog result = panel.createDialog(frame, this.title);
    result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    result.addWindowListener(this.closeListener);
    return result;
}
 
Example 3
Project: JavaGraph   File: FindReplaceDialog.java   View Source Code Vote up 6 votes
/**
 * Lazily creates and returns the option pane that is to form the content of
 * the dialog.
 */
private JOptionPane getOptionPane() {
    if (this.optionPane == null) {
        JLabel oldLabel = new JLabel(OLD_TEXT);
        JLabel newLabel = new JLabel(NEW_TEXT);
        oldLabel.setPreferredSize(newLabel.getPreferredSize());
        JPanel oldPanel = new JPanel(new BorderLayout());
        oldPanel.add(oldLabel, BorderLayout.WEST);
        oldPanel.add(getOldField(), BorderLayout.CENTER);
        oldPanel.add(getOldTypeLabel(), BorderLayout.EAST);
        JPanel newPanel = new JPanel(new BorderLayout());
        newPanel.add(newLabel, BorderLayout.WEST);
        newPanel.add(getNewField(), BorderLayout.CENTER);
        newPanel.add(getNewTypeCombobox(), BorderLayout.EAST);
        JPanel errorPanel = new JPanel(new BorderLayout());
        errorPanel.add(getErrorLabel());
        errorPanel.setPreferredSize(oldPanel.getPreferredSize());
        this.optionPane = new JOptionPane(new Object[] {oldPanel, newPanel, errorPanel},
            JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null,
            new Object[] {getFindButton(), getReplaceButton(), getCancelButton()});
    }
    return this.optionPane;
}
 
Example 4
Project: JavaGraph   File: StringDialog.java   View Source Code Vote up 6 votes
/**
 * Creates and returns a fresh dialog for the given frame.
 */
private JDialog createDialog(Component frame) {
    Object[] buttons = new Object[] {getOkButton(), getCancelButton()};
    // input panel with text area and choice box
    JPanel input = new JPanel();
    input.setLayout(new BorderLayout());
    input.setPreferredSize(new Dimension(300, 150));
    input.add(new JLabel("<html><b>Enter value:"), BorderLayout.NORTH);
    input.add(new JScrollPane(getTextArea()), BorderLayout.CENTER);
    input.add(getChoiceBox(), BorderLayout.SOUTH);
    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.add(input, BorderLayout.CENTER);
    if (this.parsed) {
        JPanel errorPanel = new JPanel(new BorderLayout());
        errorPanel.add(getErrorLabel());
        main.add(errorPanel, BorderLayout.SOUTH);
        main.add(createSyntaxPanel(), BorderLayout.EAST);
    }
    JOptionPane panel = new JOptionPane(main, JOptionPane.PLAIN_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION, null, buttons);
    JDialog result = panel.createDialog(frame, this.title);
    result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    result.addWindowListener(this.closeListener);
    return result;
}
 
Example 5
Project: JavaGraph   File: ExploreAction.java   View Source Code Vote up 6 votes
/**
 * Creates a modal dialog that will interrupt this thread, when the
 * cancel button is pressed.
 */
private JDialog createCancelDialog() {
    JDialog result;
    // create message dialog
    JOptionPane message = new JOptionPane(
        isAnimated() ? getAnimationPanel()
            : new Object[] {getStateCountLabel(), getTransitionCountLabel()},
        JOptionPane.PLAIN_MESSAGE);
    message.setOptions(new Object[] {getCancelButton()});
    result = message.createDialog(getFrame(), "Exploring state space");
    result.pack();
    result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    result.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ExploreThread.this.interrupt();
        }
    });
    result.setAlwaysOnTop(true);
    return result;
}
 
Example 6
Project: DeutschSim   File: CustomGatePrompt.java   View Source Code Vote up 5 votes
public CustomGatePrompt(final JFrame frame) {
	super(frame, true);
	
	this.frame = frame;
	
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	
	gate_name = new TextEditor("Gate name", TextEditor.Type.SINGLE_LINE);
	panel.add(gate_name);
	
	tabbed_pane = new JTabbedPane();
	
	create_rotation_panel();
	tabbed_pane.add("Rotation", rotation_panel);
	
	create_phase_shift_panel();
	tabbed_pane.add("Phase Shift", phase_shift_panel);
	
	create_matrix_panel();
	tabbed_pane.add("Matrix", matrix_panel);
	
	tabbed_pane.addChangeListener(new TabbedPaneListener(tabbed_pane));
	panel.add(tabbed_pane);
	
	trig_selection = new AngleTypeSelection("What to represent arguments of " + 
			"trigonometric functions in?");
	panel.add(trig_selection);
	
	option_pane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_OPTION,
			null, new Object[] {"Create Gate"});
	
	setTitle("Create Custom Gate");
	setResizable(false);
	setContentPane(option_pane);
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	pack();
	
	option_pane.addPropertyChangeListener(new OKButtonListener());
}
 
Example 7
Project: org.alloytools.alloy   File: OurDialog.java   View Source Code Vote up 5 votes
/**
 * Popup the given informative message, then ask the user to click Close to
 * close it.
 */
public static void showmsg(String title, Object... msg) {
	JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
	Object[] objs = new Object[msg.length + 1];
	System.arraycopy(msg, 0, objs, 0, msg.length);
	objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
	JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
			new Object[] {});
	JDialog dialog = about.createDialog(null, title);
	dismiss.addActionListener(Runner.createDispose(dialog));
	dialog.setAlwaysOnTop(true);
	dialog.setVisible(true);
	dialog.dispose();
}
 
Example 8
Project: JavaGraph   File: LibrariesTable.java   View Source Code Vote up 5 votes
/** Shows the content of this table as a dialog. */
public void showDialog(Component parent) {
    JScrollPane scrollPane = new JScrollPane(this);
    Dimension size = scrollPane.getPreferredSize();
    size.height = getPreferredSize().height;
    scrollPane.getViewport().setPreferredSize(size);
    JOptionPane optionPane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE);
    JDialog dialog = optionPane.createDialog(parent, "External libraries used in GROOVE");
    dialog.setVisible(true);
}
 
Example 9
Project: JavaGraph   File: FreshNameDialog.java   View Source Code Vote up 5 votes
/**
 * Lazily creates and returns the option pane that is to form the content of
 * the dialog.
 */
private JOptionPane getOptionPane() {
    if (this.optionPane == null) {
        JTextField nameField = getNameField();
        this.optionPane = new JOptionPane(new Object[] {nameField, getErrorLabel()},
            JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null,
            new Object[] {getOkButton(), getCancelButton()});
    }
    return this.optionPane;
}
 
Example 10
Project: JavaGraph   File: PropertiesDialog.java   View Source Code Vote up 5 votes
JOptionPane getContentPane() {
    if (this.pane == null) {
        int mode;
        Object[] buttons;
        mode = JOptionPane.OK_CANCEL_OPTION;
        buttons = new Object[] {getOkButton(), createCancelButton()};
        this.pane =
            new JOptionPane(createTablePane(), JOptionPane.PLAIN_MESSAGE, mode, null, buttons);
    }
    return this.pane;
}
 
Example 11
Project: JavaGraph   File: NumberDialog.java   View Source Code Vote up 5 votes
/**
 * Lazily creates and returns the option pane that is to form the content of
 * the dialog.
 */
private JOptionPane getOptionPane() {
    if (this.optionPane == null) {
        this.optionPane =
            new JOptionPane(getNumberPanel(), JOptionPane.PLAIN_MESSAGE,
                JOptionPane.OK_CANCEL_OPTION, null, new Object[] {getOkButton(),
                    getCancelButton()});
    }
    return this.optionPane;
}
 
Example 12
Project: JavaGraph   File: ContributorsTable.java   View Source Code Vote up 5 votes
/** Shows the content of this table as a dialog. */
public void showDialog(Component parent, String title) {
    JScrollPane scrollPane = new JScrollPane(this);
    scrollPane.getViewport().setPreferredSize(getPreferredSize());
    JOptionPane optionPane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE);
    JDialog dialog = optionPane.createDialog(parent, title);
    dialog.setVisible(true);
}
 
Example 13
Project: JavaGraph   File: SaveLTSAsDialog.java   View Source Code Vote up 5 votes
/**
 * @return the contentpane
 */
JOptionPane getContentPane() {
    Object[] buttons = new Object[] {getOkButton(), getCancelButton()};
    if (this.pane == null) {
        this.pane =
            new JOptionPane(createPanel(), JOptionPane.PLAIN_MESSAGE,
                JOptionPane.OK_CANCEL_OPTION, null, buttons);
        ToolTipManager.sharedInstance().registerComponent(this.pane);
        // new JOptionPane(createPanel(), JOptionPane.PLAIN_MESSAGE,
        // JOptionPane.OK_CANCEL_OPTION, null, buttons);
    }
    return this.pane;
}
 
Example 14
Project: JavaGraph   File: Viewer.java   View Source Code Vote up 5 votes
/** Shows a given graph in an optionally modal dialog. */
private void show(final Graph graph, GrammarModel grammar, boolean modal) {
    GraphPreviewPanel panel = GraphPreviewDialog.createPanel(grammar, graph);
    panel.add(new NodeIdsButton(panel), BorderLayout.NORTH);
    JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE);
    JDialog dialog = optionPane.createDialog(graph.getName());
    dialog.setModal(modal);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
}
 
Example 15
Project: Tarski   File: OurDialog.java   View Source Code Vote up 5 votes
/** Popup the given informative message, then ask the user to click Close to close it. */
public static void showmsg(String title, Object... msg) {
   JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
   Object[] objs = new Object[msg.length + 1];
   System.arraycopy(msg, 0, objs, 0, msg.length);
   objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
   JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{});
   JDialog dialog = about.createDialog(null, title);
   dismiss.addActionListener(Runner.createDispose(dialog));
   dialog.setAlwaysOnTop(true);
   dialog.setVisible(true);
   dialog.dispose();
}
 
Example 16
Project: Tarski   File: OurDialog.java   View Source Code Vote up 5 votes
/** Popup the given informative message, then ask the user to click Close to close it. */
public static void showmsg(String title, Object... msg) {
   JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
   Object[] objs = new Object[msg.length + 1];
   System.arraycopy(msg, 0, objs, 0, msg.length);
   objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
   JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{});
   JDialog dialog = about.createDialog(null, title);
   dismiss.addActionListener(Runner.createDispose(dialog));
   dialog.setAlwaysOnTop(true);
   dialog.setVisible(true);
   dialog.dispose();
}
 
Example 17
Project: JAddOn   File: JWaitingDialog.java   View Source Code Vote up 4 votes
public void createDialog() {
    if(running) {
        return;
    }
    pane = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, iconplus.getImageIcon(), options, null);
}
 
Example 18
Project: JavaGraph   File: BoundedModelCheckingDialog.java   View Source Code Vote up 4 votes
JOptionPane createContentPane() {
    Object[] buttons = new Object[] {getOkButton(), getCancelButton()};
    this.pane = new JOptionPane(createPanel(), JOptionPane.PLAIN_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION, null, buttons);
    return this.pane;
}
 
Example 19
Project: JavaGraph   File: Imager.java   View Source Code Vote up 2 votes
/**
 * Creates and returns a plain option pane on the basis of a given
 * message panel and row of buttons.
 * @param messagePane the central message pane
 * @param buttonRow the buttons to be displayed at the bottom of the
 *        pane
 */
protected JOptionPane createOptionPane(JPanel messagePane, JButton[] buttonRow) {
    return new JOptionPane(messagePane, JOptionPane.PLAIN_MESSAGE,
        JOptionPane.DEFAULT_OPTION, null, buttonRow);
}