2016-10-01 89 views
0

有什么办法来改变按钮OK称号JOptionPane.showConfirmDialog比如我有一个小组,我想表明它JOptionPane.showConfirmDialog这样更改标题JOptionPane.showConfirmDialog

MyPanel pan = new MyPanel(); 

int result = JOptionPane.showConfirmDialog(null, venteFam, 
     "Title of the panel", JOptionPane.OK_CANCEL_OPTION); 

这个节目里面我:

enter image description here

所以,我需要的是改变确定和取消标题到另一个标题,这可能吗?

谢谢。

回答

2

您可以使用JOptionPane.showOptionDialog,它可以让你提供你自己的文本作为数组,而不是JOptionPane.showConfirmDialog:

JOptionPane.showOptionDialog(null, 
 
     "Do you like this answer?", 
 
     "Feedback", 
 
     JOptionPane.OK_CANCEL_OPTION, 
 
     JOptionPane.INFORMATION_MESSAGE, 
 
     null, 
 
     new String[]{"Yes I do", "No I don't"}, 
 
     "default");

+0

谢谢这应该工作 –