當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。