当前位置: 首页>>代码示例>>Java>>正文


Java JOptionPane.PLAIN_MESSAGE属性代码示例

本文整理汇总了Java中javax.swing.JOptionPane.PLAIN_MESSAGE属性的典型用法代码示例。如果您正苦于以下问题:Java JOptionPane.PLAIN_MESSAGE属性的具体用法?Java JOptionPane.PLAIN_MESSAGE怎么用?Java JOptionPane.PLAIN_MESSAGE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.JOptionPane的用法示例。


在下文中一共展示了JOptionPane.PLAIN_MESSAGE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

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;
        }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:Terminal.java

示例2: createDialog

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:27,代码来源:FormulaDialog.java

示例3: getOptionPane

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:26,代码来源:FindReplaceDialog.java

示例4: createDialog

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:28,代码来源:StringDialog.java

示例5: createCancelDialog

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:24,代码来源:ExploreAction.java

示例6: CustomGatePrompt

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());
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:40,代码来源:CustomGatePrompt.java

示例7: showmsg

/**
 * 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();
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:17,代码来源:OurDialog.java

示例8: showDialog

/** 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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:10,代码来源:LibrariesTable.java

示例9: getOptionPane

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:FreshNameDialog.java

示例10: getContentPane

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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:11,代码来源:PropertiesDialog.java

示例11: getOptionPane

/**
 * 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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:NumberDialog.java

示例12: showDialog

/** 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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:8,代码来源:ContributorsTable.java

示例13: getContentPane

/**
 * @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;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:15,代码来源:SaveLTSAsDialog.java

示例14: show

/** 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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:10,代码来源:Viewer.java

示例15: showmsg

/** 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();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:OurDialog.java


注:本文中的javax.swing.JOptionPane.PLAIN_MESSAGE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。