将Java框中的消息头更改为;如果;及;否则";
如果有多个字符串和整数一起工作,如何更改showMessageDialog中的消息头 这就是我如何让它工作的方法:将Java框中的消息头更改为;如果;及;否则";,java,swing,joptionpane,Java,Swing,Joptionpane,如果有多个字符串和整数一起工作,如何更改showMessageDialog中的消息头 这就是我如何让它工作的方法: showMessageDialog (null, "string", "where I change the name of the box", INFORMATION_MESSAGE); if (price >= 300) { deduction = price * 0.10; price = price - deduction; showMes
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);
这是我无法让它工作的地方:
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给出以下错误消息:
中的方法showMessageDialog(组件、对象、字符串、int)
类型JOptionPane不适用于参数(null、String、,
String,String)“并建议我创建方法showMessageDialog
(对象,字符串,字符串,字符串)
有什么建议吗?:) 信息\u消息是定义消息类型的常量。请尝试使用以下方法:
showMessageDialog(null, "Total price: ", price + " ." + " Received deduction: " + deduction, INFORMATION_MESSAGE);
我不能说我真的理解这个问题,尽管试试看
showMessageDialog (null, "Total price: " +
+ price + " ." + " Received deduction: " + deduction,
"where I want to change the name", INFORMATION_MESSAGE);