自定义 JOptionPane 消息对话框按钮时出错

Error when customising JOptionPane Message Dialog Buttons

我在尝试自定义 showMessageDialog 按钮说 "Start" 而不是 OK 时收到错误消息:no suitable method found for showMessageDialog

这是代码:

JOptionPane.showMessageDialog(frame, radioPanel, "Start Game", JOptionPane.PLAIN_MESSAGE, null, new String[]{"Start"});

有人可以指出为什么我会收到此错误。

提前致谢

showMessageDialog有3个重载:

您正在尝试使用 6 个参数调用此方法,因此 none 适用。您需要仔细阅读文档以决定您需要哪一个。