JOptionPane showConfirmDialog只有一个按钮 [英] JOptionPane showConfirmDialog with only one button
本文介绍了JOptionPane showConfirmDialog只有一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在 showConfirmDialog
中只有一个按钮。
I need to have only one button in showConfirmDialog
.
我试过这个:
int response = JOptionPane.showConfirmDialog(null, "Time Entered Successfully",
"", JOptionPane.OK_OPTION, JOptionPane.PLAIN_MESSAGE);
if (response == JOptionPane.CLOSED_OPTION || response == JOptionPane.OK_OPTION)
{
System.out.println("CLOSING>>>>>>");
}
但这会显示Yes_No_option对话框。
But this shows dialog with Yes_No_option.
我只想在那里显示OK按钮。有可能吗?
I want only OK button to be displayed there. Is it possible?
推荐答案
我只想在那里显示OK按钮。有可能吗?
I want only OK button to be displayed there. Is it possible?
使用 showOptionDialog()方法。
Object[] options = {"OK"};
int n = JOptionPane.showOptionDialog(frame,
"Message here ","Title",
JOptionPane.PLAIN_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
这篇关于JOptionPane showConfirmDialog只有一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文