如何通过swing在对话框中创建“yes to all”选项
我想创建一个对话框,其中包含四个按钮
- yes
- no
- yes to all
- cancel
我可以创建对话框,但无法在 yes to all 按钮中添加操作。
Object[] options = {"Yes", "No", "Yes To All", "Cancel"};
int n = JOptionPane.showOptionDialog(MainGui.appView, "file "+tempFile+
"exits.\n Do you wish to overwrite?", "Question",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[2]);
I want to create a dialog box which contain four button
- yes
- no
- yes to all
- cancel
I'm able to create dialog but I am unable to add action in yes to all button.
Object[] options = {"Yes", "No", "Yes To All", "Cancel"};
int n = JOptionPane.showOptionDialog(MainGui.appView, "file "+tempFile+
"exits.\n Do you wish to overwrite?", "Question",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[2]);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查
n
的值。如下所示:您可以切换
n
并分别执行操作。Check for value of
n
. It will be as follows:You can switch over
n
and do action respectively.