如果我有多个字符串和整数一起工作,如何更改 showMessageDialog 中的消息头?
这就是我可以使它工作的方法:
showMessageDialog (null, "string", "where I change the name of the box", INFORMATION_MESSAGE);
这是我无法使它工作的地方:
if (price >= 300) {
deduction = price * 0.10;
price = price - deduction;
showMessageDialog (null, "Total price: ",
"where I want to change the name", INFORMATION_MESSAGE
+ price + " ." + " Received deduction: " + deduction);
Eclipse 给出以下错误消息:
“JOptionPane 类型中的方法 showMessageDialog (Component, Object, String, int) 不适用于参数 (null, String, String, String)”并建议我创建方法 showMessageDialog (Object, String, String, String)。
有什么建议么?:)