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


Java JOptionPane.DEFAULT_OPTION属性代码示例

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


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

示例1: show

/** Helper method for constructing an always-on-top modal dialog. */
private static Object show(String title, int type, Object message, Object[] options, Object initialOption) {
	if (options == null) {
		options = new Object[] {
				"Ok"
		};
		initialOption = "Ok";
	}
	JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption);
	p.setInitialValue(initialOption);
	JDialog d = p.createDialog(null, title);
	p.selectInitialValue();
	d.setAlwaysOnTop(true);
	d.setVisible(true);
	d.dispose();
	return p.getValue();
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:17,代码来源:OurDialog.java

示例2: setUp

@Override
protected void setUp() throws Exception {
    LOG = Logger.getLogger("test." + getName());
    dd = new DialogDisplayerImpl (RESULT);
    closeOwner = new JButton ("Close this dialog");
    childDD = new DialogDescriptor ("Child", "Child", false, null);
    openChild = new JButton ("Open child");
    closeChild = new JButton ("Close child");
    pane = new JOptionPane ("", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {openChild, closeChild});
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:DialogDisplayerImplTest.java

示例3: 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

示例4: show

/** Helper method for constructing an always-on-top modal dialog. */
private static Object show(String title, int type, Object message, Object[] options, Object initialOption) {
   if (options == null) { options = new Object[]{"Ok"};  initialOption = "Ok"; }
   JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption);
   p.setInitialValue(initialOption);
   JDialog d = p.createDialog(null, title);
   p.selectInitialValue();
   d.setAlwaysOnTop(true);
   d.setVisible(true);
   d.dispose();
   return p.getValue();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:OurDialog.java

示例5: 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

示例6: showNoteDialog

private static void showNoteDialog (String note) {
    Util.setDefaultLookAndFeel();
    JOptionPane p = new JOptionPane(new AutoUpgradePanel (null, note), JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION);
    JDialog d = Util.createJOptionDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Note_Title"));
    d.setVisible (true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:AutoUpgrade.java

示例7: ErrorDialog

/**
 * Constructs a new error dialog, with the same top-level frame as the given
 * component, a simple error message, and an exception giving more detail
 * about the error. The dialog is not yet shown.
 */
public ErrorDialog(Component component, String message, Throwable exc) {
    super(getParentFrame(component), ERROR_MESSAGE_TEXT, true);
    setLocationRelativeTo(component);
    this.exc = exc;

    // setup cancel button
    JComponent cancelPane = Box.createHorizontalBox();
    this.cancelButton = new JButton(CANCEL_BUTTON_TEXT);
    cancelPane.add(Box.createHorizontalGlue());
    cancelPane.add(this.cancelButton);
    cancelPane.add(Box.createHorizontalGlue());
    this.cancelButton.setSelected(true);

    // setup details pane
    this.detailsButton = new JButton(NO_DETAILS_BUTTON_TEXT);
    this.detailsButton.setEnabled(exc != null);
    JComponent detailsButtonPane = Box.createHorizontalBox();
    detailsButtonPane.add(this.cancelButton);
    detailsButtonPane.add(Box.createHorizontalGlue());
    detailsButtonPane.add(this.detailsButton);

    this.detailsPane = new JPanel(new BorderLayout());
    this.detailsPane.add(detailsButtonPane, BorderLayout.SOUTH);

    // setup message pane
    JPanel messagePane = new JPanel(new BorderLayout());
    messagePane.setPreferredSize(new Dimension(300, 100));
    messagePane.add(this.detailsPane, BorderLayout.CENTER);

    // setup option pane
    JOptionPane optionPane =
        new JOptionPane(message, JOptionPane.ERROR_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
            new Object[] {messagePane});
    optionPane.add(messagePane, BorderLayout.SOUTH);
    // setup content pane
    Container contentPane = getContentPane();
    contentPane.add(optionPane);
    // constrain size to maximum
    setPreferredSize();

    // setup text area
    this.detailsArea = new JTextArea();
    this.detailsArea.setEditable(false);
    this.detailsTextPane = new JScrollPane(this.detailsArea);
    this.detailsTextPane.setPreferredSize(new Dimension(300, 100));
    this.detailsTextPane.setBorder(new EmptyBorder(5, 0, 5, 0));
    setDetailsLevel(NO_DETAILS);

    // setup button listener
    ActionListener buttonListener = new ButtonListener();
    this.cancelButton.addActionListener(buttonListener);
    this.detailsButton.addActionListener(buttonListener);
    pack();
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:59,代码来源:ErrorDialog.java

示例8: createOptionPane

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


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