Hi guys
I can't seem to get a new line in a
JOptionPane.showMessageDialog(null, " ");
statement. I try the /n command, but it still doesn't seem to work.
Is there any way I can get a paragraph in a dialog box like this?
Thanks.
Hi guys
I can't seem to get a new line in a
JOptionPane.showMessageDialog(null, " ");
statement. I try the /n command, but it still doesn't seem to work.
Is there any way I can get a paragraph in a dialog box like this?
Thanks.
That because the slash is the opposite direction not forward slash "/" but backward slash "\"
import javax.swing.JOptionPane;
public class NewLine
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog
(null, "peter_budo"+"\nCode tags enforcer"
,"My Message", JOptionPane.WARNING_MESSAGE);
}
}
Thanks so very much, I keep on making these stupid errors.
Just on the side, is there any way to edit the title of the showMessageDialog? and possibly the icon?
Thanks again.
EDIT: Are the strings ,"My message", and JOptionPane.WARNING_MESSAGE
Exactly what I'm looking for? What are the keywords for different icons?
Sorry, I never actually compiled it, I just had a look.
Check the API doc for JOptionPane. The dialogs have several constructors you can choose from depending on how much you want to specify on it. The docs describe the constants you can supply for each of the parameters.
I hate to be beaten for fastest answer :twisted:
Yes "My message" is title that you can edit
Other possible messages types
ERROR_MESSAGE
INFORMATION_MESSAGE
QUESTION_MESSAGE
PLAIN_MESSAGE
Anyway here is tutorial on How to Make Dialogs from Java Sun website
Ok, thanks very much.
And thanks for helping with my petty questions.
Thread solved.
As long you attempt to make the thing works and do not expect it to do it all for you there is always some willing person to help. It doesn't matter how trivial the question can be.
Any of us walked the same road, with differentiate only in distanced covered and directions taken on the cross roads...
Publilius Syrus
(~100 BC)
Maybe?
More likely
peter_budo
(2008 AD)
LOL nice,
I thought you were going to ask wtf I was talking about.
:)
yea bro
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.