我将如何展示JOptionPane.showinputDialog()
与多个JButtons
每行?我不是在谈论Yes
, No
, Cancel
按钮但有多个自定义标签JButtons
显示在内容区域JOptionPane.showinputDialog
?
所以我需要获取按下按钮的值JOptionPane
以及。
您可以放置任何JComponents
to the J选项面板,在那里我看不到任何限制,JOptionPane
是一样的顶级容器 as JFrame
, JDialog
or JWindow
,但与普通的相反Top-Level Containers
, JOptionPane
已经实现了来自内置功能的返回事件Integer
值,含义按钮YES
, NO
, OK
, CANCEL
and CLOSE
too,
将所有 JButton 放入数组中
String[] buttons = { "Yes", "Yes to all", "No", "Cancel".... };
int returnValue = JOptionPane.showOptionDialog(null, "Narrative", "Narrative",
JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[i]);
System.out.println(returnValue);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)