如何 运行 JOptionPane 对象
how to run JOptionPane object
我有这个代码 运行 JOptionPane 对象
import 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);
optionPane.createDialog("click");
}
}
然而,当我 运行 createDialog 方法没有任何反应时,如何正确地 运行 JOptionPane 对象?
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);
}
}
使用 JDialog 显示您的 window
我有这个代码 运行 JOptionPane 对象
import 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);
optionPane.createDialog("click");
}
}
然而,当我 运行 createDialog 方法没有任何反应时,如何正确地 运行 JOptionPane 对象?
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);
}
}
使用 JDialog 显示您的 window