java更改JOptionPane中的按钮布局。showOptionDialog()
我正在开发一个程序,让用户从命令列表中进行选择。我的程序有几个命令和JOptionPane。showOptionDialog()水平显示它们
正如你所见,窗户比我的屏幕还宽。我想让它有两排按钮,而不是一排,这样用户可以看到所有的选项
到底要怎么做
这是我的代码:
public int getCommand (String[] commands) {
return JOptionPane.showOptionDialog
(null,
"Choose an option below", // Prompt message
windowTitle, // Window title
JOptionPane.YES_NO_CANCEL_OPTION, // Option type
JOptionPane.QUESTION_MESSAGE, // Message type
null, // Icon
commands, // List of commands
commands[commands.length - 1]);
}
共 (0) 个答案