[英]Java JoptionsPane button strings
我想知道是否有一種方法可以更改默認的joptions窗格按鈕字符串,而不是說“ ok”和“ cancel”來表示諸如“ option1”和“ option2”之類的其他內容。 謝謝!
這對我有用
String[] choices = { "Option 1", "Option 2", "Option 3", "Option 4" };
int response = JOptionPane.showOptionDialog(null, "Dialog text",
"Title", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE,
null, choices, null);
System.out.println(response);
如果取消對話框,它將返回0-3
(選擇的選項)或-1
。
是的,有一種方法可以...在這里看看...。
String[] options = new String[] {"op1", "op2", "op3"};
JOptionPane.showOptionDialog(null, "Options", "Hi there",
JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE,
null, options, options[0]);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.