複数の文字列と整数を一緒に使用している場合、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) を作成することを提案します。
助言がありますか?:)