如何在Java中为用户显示消息框
我想显示一个消息框,用Java显示一些消息,该框应该有三个按钮,用户可以按下,这样当用户按下按钮时程序可以得到值。如果使用Java Swing,请查看如何在Java中为用户显示消息框,java,swing,Java,Swing,我想显示一个消息框,用Java显示一些消息,该框应该有三个按钮,用户可以按下,这样当用户按下按钮时程序可以得到值。如果使用Java Swing,请查看 如果您使用Java Swing,请查看 我想这就是你要找的 //Custom button text Object[] options = {"Yes, please", "No, thanks", "No eggs, no ham!"}; int n = JOptionPane.s
如果您使用Java Swing,请查看
我想这就是你要找的
//Custom button text
Object[] options = {"Yes, please",
"No, thanks",
"No eggs, no ham!"};
int n = JOptionPane.showOptionDialog(frame,
"Would you like some green eggs to go "
+ "with that ham?",
"A Silly Question",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[2]);
请参阅oracle文档我想这就是您要找的
//Custom button text
Object[] options = {"Yes, please",
"No, thanks",
"No eggs, no ham!"};
int n = JOptionPane.showOptionDialog(frame,
"Would you like some green eggs to go "
+ "with that ham?",
"A Silly Question",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[2]);
请参阅oracle文档你所说的“跳转框”是什么意思?是指像JopOptions Pane一样,在程序运行时跳转框我记得我以前使用过一些类,可以添加按钮名,但我忘记了类名。像JopOptions Pane一样“使用
JopOptions Pane
。你所说的“跳转框”是什么意思?是指像JopOptions Pane一样,程序运行时跳框我记得我以前使用过一些类,可以添加按钮名,但我忘记了类名“.like JOptionPane”使用JOptionPane
。