javax.swing.JOptionPane.createDialog()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中javax.swing.JOptionPane.createDialog()方法的一些代码示例,展示了JOptionPane.createDialog()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JOptionPane.createDialog()方法的具体详情如下:
包路径:javax.swing.JOptionPane
类名称:JOptionPane
方法名:createDialog

JOptionPane.createDialog介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

encodingPanel.add(textPanel);
encodingPanel.add(Box.createVerticalStrut(5));
final JOptionPane fileFilterDialog = new JOptionPane();
fileFilterDialog.setMessage(encodingPanel);
JButton[] options = new JButton[3];
final JDialog dialog = fileFilterDialog.createDialog(null, "Default encoding changed...");
useNewEncoding.addActionListener(arg0 -> {
 FileTreeModel.setCurEncoding(encoding);
  System.out.println("encoding null!!");
 setEncoding.setText(encoding);
 dialog.setVisible(false);
});
useOldEncoding.addActionListener(e -> dialog.setVisible(false));
useAnotherEncoding.addActionListener(e -> {
 dialog.setVisible(false);
 alternateEncodingPrompt(encoding);
});

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane(arguments);
pane.set.Xxxx(...); // Configure
JDialog dialog = pane.createDialog(parentComponent, title);
// here set the dialog's location
dialog.setVisible(true);

代码示例来源:origin: org.scijava/scijava-ui-swing

public SwingDialogPrompt(final String message, final String title,
  final MessageType messageType, final OptionType optionType)
{
  pane =
    new JOptionPane(message, msgMap.get(messageType), optionMap
      .get(optionType));
  // pane.set.Xxxx(...); // Configure
  dialog = pane.createDialog(null, title);
  // dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}

代码示例来源:origin: stanfordnlp/CoreNLP

final JOptionPane fileFilterDialog = new JOptionPane();
fileFilterDialog.setMessage(fileFilterPanel);
JButton[] options = new JButton[3];
final JDialog dialog = fileFilterDialog.createDialog(null, "Set file filters...");
okay.addActionListener(arg0 -> {
 dialog.setVisible(false);
 startFileLoadingThread(filters, cFiles);
});
 dialog.pack();
});
cancel.addActionListener(e -> dialog.setVisible(false));
dialog.getRootPane().setDefaultButton(okay);
dialog.pack();
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane("Message", JOptionPane.INFORMATION_MESSAGE);
     JDialog dialog = pane.createDialog(null, "Title");
     dialog.setModal(false);
     dialog.setVisible(true);
     new Timer(10000, new ActionListener() {
       @Override
       public void actionPerformed(ActionEvent e) {
         dialog.setVisible(false);
       }
     }).start();

代码示例来源:origin: net.imagej/ij-ui-swing

public SwingDialogPrompt(final String message, final String title,
  final MessageType messageType, final OptionType optionType)
{
  pane =
    new JOptionPane(message, msgMap.get(messageType), optionMap
      .get(optionType));
  // pane.set.Xxxx(...); // Configure
  dialog = pane.createDialog(null, title);
}

代码示例来源:origin: libgdx/libgdx

JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,
  null);
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: stackoverflow.com

JProgressBar pb = new JProgressBar();
     JOptionPane op = new JOptionPane(pb, JOptionPane.PLAIN_MESSAGE,
         JOptionPane.DEFAULT_OPTION);
     JDialog dlg = op.createDialog(MyJFrame.this, "Progress");
     dlg.setVisible(true);

代码示例来源:origin: stackoverflow.com

import javax.swing.JDialog;
import javax.swing.JOptionPane;
public class TheComboBoxes {
  public static void main(String[] args) {
    JOptionPane optionPane = new JOptionPane("The only way to close this dialog is by\n"
        + "pressing one of the following buttons.\n" + "Do you understand?", JOptionPane.QUESTION_MESSAGE,
        JOptionPane.YES_NO_OPTION);
    JDialog dialog = optionPane.createDialog("click");
    dialog.setVisible(true);
  }
}

代码示例来源:origin: libgdx/libgdx

JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,
  null);
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: stackoverflow.com

private static void showErrorPane(String message, String title) {
  JOptionPane pane = new JOptionPane(message, JOptionPane.ERROR_MESSAGE);
  JDialog dialog = pane.createDialog(title);
  dialog.setAlwaysOnTop(true);
  dialog.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane("pane");
JDialog dialog = pane.createDialog(null, "Title");
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
dialog.show();

代码示例来源:origin: libgdx/libgdx

JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,
  null);
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: stackoverflow.com

JOptionPane optionPane = new JOptionPane("Do you really want to?",
    JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dialog = optionPane.createDialog(jf, "Confirm");

dialog.setVisible(true);
dialog.dispose();

int opt = (int) optionPane.getValue();
if(opt == JOptionPane.OK_OPTION) {
  System.out.println("Ok then!");
} else {
  System.out.println("Didn't think so.");
}

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane("message");
JDialog dialog = pane.createDialog(null, "Title");
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
dialog.show();

代码示例来源:origin: libgdx/libgdx

JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,
  null);
placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: stackoverflow.com

exm:- setWarningMsg("thank you for using java");

public static void setWarningMsg(String text){
  Toolkit.getDefaultToolkit().beep();
  JOptionPane optionPane = new JOptionPane(text,JOptionPane.WARNING_MESSAGE);
  JDialog dialog = optionPane.createDialog("Warning!");
  dialog.setAlwaysOnTop(true);
  dialog.setVisible(true);
}

代码示例来源:origin: freeplane/freeplane

public static JDialog createCancelDialog(final Component component, final String titel, final String text) {
  final String[] options = { TextUtils.getText("cancel") };
  final JOptionPane infoPane = new JOptionPane(text, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
    options);
  JDialog dialog = infoPane.createDialog(component, titel);
  dialog.setModal(false);
  return dialog;
}

代码示例来源:origin: stackoverflow.com

JOptionPane optionPane = new JOptionPane();
JDialog dialog = optionPane.createDialog("Title");
dialog.setAlwaysOnTop(alwaysOnTop);
dialog.setVisible(true);

代码示例来源:origin: stackoverflow.com

JOptionPane optionPane = new JOptionPane("ErrorMsg", JOptionPane.ERROR_MESSAGE);    
JDialog dialog = optionPane.createDialog("Failure");
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);

相关文章