Link to home
Start Free TrialLog in
Avatar of javamate06
javamate06

asked on

JOptionPane Parameters

The title in the

JOptionPane.showMessageDialog(this,"HI");

Will be “Massage” and I think this by default

Can I change the title and the color or the font of the message string = “HI“?
Avatar of girionis
girionis
Flag of Greece image

Hi javamate06

yes you can change the title, you should use this

public static void showMessageDialog(this, "HI", "My title", JOptionPane.INFORMATION_MESSAGE)


Cheers
void javax.swing.JOptionPane.showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) throws HeadlessException

You can change the title and icon of the message window, but not the fong and color. Font and color are part of the Look And Feel that you are using.
Avatar of javamate06
javamate06

ASKER

Thank you...

In the
 public static void showMessageDialog(this, "HI", "My title", JOptionPane.INFORMATION_MESSAGE)

and specifically in

“this”

parameter I have an error which expecting identifier.

Please, how to call this to show the message.


this represents the parent window. If you supply a parent, then the showd message will be modal to that parent. If you supply null, that displayed window will not have a parent.
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial