import javax.swing.JFrame;Output
import javax.swing.JOptionPane;
public class Inputdialog {
public static void main(String[] args) {
JFrame frame = new JFrame(”);
String return = JOptionPane.showInputDialog(
frame, 输入你的名字”,Dialog”,
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
import javax.swing.JFrame;Execution:
import javax.swing.JOptionPane;
public class Inputdialog {
public static void main(String[] args) {
JFrame frame = new JFrame(”);
对象 [] 选择 = {1,2,3,4,5,6};
String return = (String) JOptionPane.showInputDialog(
frame, 选择索引”,
Dialog”,
JOptionPane.QUESTION_MESSAGE,
null, selection, selection[0]);
System.exit(0);
}
}
ImageIcon icon = new ImageIcon(question.png”);Execution:
对象[] 选择 = {1,2,3,4,5,6};
String back = (String) JOptionPane.showInputDialog(frame, 选择索引”,
Dialog”,JOptionPane.QUESTION_MESSAGE,
icon, selection, selection[0]);
Please disable your ad blocker and refresh the window to use this website.