Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Java框中的消息头更改为;如果;及;否则";_Java_Swing_Joptionpane - Fatal编程技术网

将Java框中的消息头更改为;如果;及;否则";

将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中的消息头

这就是我如何让它工作的方法:

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);