java - How to place an integer you just inputted on the dialog box TITLE bar -
hello people of stackoverflow, i'm trying create java programme has title bar inputted integer. here's little of code:
import javax.swing.joptionpane; public class converthourstominutes { public static void main(string args[]) { int hours; int minutes; hours=integer.parseint(joptionpane.showinputdialog(null,"enter hour: ")); minutes=hours*60; joptionpane.showmessagedialog(null,"converted minutes is: " +minutes,"is equivalent to",joptionpane.information_message); }
}
what want happen that, on title bar of dialog box, default on output what's written message right? wanted create it, " the number inputted user equivalent to" have on title bar "in minutes is..." please help thanks. tried searching on google can't find answers.
for example, user entered 1.
so title bar (i hoping) should be...
1 in minutes is...
then output goes
you forgot add together variable string in message box. alter message dialog following:
joptionpane.showmessagedialog(null, "converted minutes is: " + minutes, hours + " equivalent to", joptionpane.information_message);
according constructor using, set the
message: "converted minutes 60" //for illustration title: "is equivelant to: 1" //for illustration
java dialog joptionpane titlebar box
No comments:
Post a Comment