How do I change the message header in a showMessageDialog if I have several strings and integers working together?
This is how I can make it work:
showMessageDialog (null, "string", "where I change the name of the box", INFORMATION_MESSAGE);
This is where I can't make it work:
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 gives the following error message:
"The method showMessageDialog (Component, Object, String, int) in the type JOptionPane is not applicable for the arguments (null, String, String, String)" and suggests that I create method showMessageDialog (Object, String, String, String).
Any suggestions? :)
INFORMATION_MESSAGE is a constant that defines the message type. Try using this way instead:
showMessageDialog(null, "Total price: ", price + " ." + " Received deduction: " + deduction, INFORMATION_MESSAGE);