使用此代码,图标不会被删除
int returnValue = JOptionPane.showOptionDialog(null, "Successfully Updated", "Message",
JOptionPane.PLAIN_MESSAGE, 0, null, buttons, buttons[0]);
我还不允许上传图片
答案 0 :(得分:3)
您已在错误的参数字段中指定了消息类型。
您的代码看起来应该是这样的。
int returnValue = JOptionPane.showOptionDialog(null, "Successfully Updated", "Message",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0]);
' JOptionpane.OK_CANCEL_OPTION'可以改成任何你想要的东西,我把它搞砸了一下,它给你的用途似乎并不重要。
新选项对话框看起来像这样(从我用上面的代码运行时)。