JOptionPane.showMessageDialog(null, "First line.",acctStr +
"\n Second line.",nameStr +
"\\n Your total for regular service is $%.2f %n",regtotal );
showMessageDialog is red saying that The method showMessageDialog(Component, Object, String, int, Icon) in the type JOptionPane is not applicable for the arguments (null, String, String, String, double)
i need to have a j option multi line output, but its not just text, some are also variables, what code am i missing?
static void showMessageDialog(Component parentComponent, Object message)
Brings up an information-message dialog titled "Message".
static void showMessageDialog(Component parentComponent, Object message, String title, int messageType)
Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
static void showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
Brings up a dialog displaying a message, specifying all parameters.
static int showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
Brings up a dialog with a specified icon, where the initial choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.
im sorry, but i have no clue what im looking at.
how would i impliment all of that to:
"text", variable in string format \n
"text", variable in string format \n
"text" varible in double.
I don't even remember the last time I dabbled in the JOptionPane.
First off, it doesn't accept double. You look silly for even thinking puppy dog eyes could solve that problem. Format the String outside of the dialog box - String.format() - and then pass it in; if you need an updating value, keep reformatting the String to the same reference and pray. Here's your param explanation (from the javadoc; I shouldn't have to paste this!): Component parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
Object message - the Object to display
String title - the title string for the dialog
int optionType - an int designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
Be mindful of the possibility of a HeadlessException. And whatever you do, don't post here ever again.
Name:
Anonymous2011-03-25 7:11
yeh i figured id have to put the double back into string.
ok so mine is set to null and i have my message,but its not multi line.
though good to know thats a confirmation dialoug, im just trying to do a multi line output, which sadly is a great deal more difficult then it should be. i've settled with:
String[] arrMsg = {"First line.",acctStr
"Second line.",nameStr "your total for regular service is:",totalStr
};
though id rather have it on 3 lines than 6, but i just want to be done with this.
Name:
Anonymous2011-03-25 9:12
>>5 And whatever you do, don't post here ever again.
Go fuck a goat.