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“?
javamate06Asked:
Who is Participating?
 
girionisConnect With a Mentor Commented:
YOu should call it like:

JOptionPane.showMessageDialog(this, "HI", "My title", JOptionPane.INFORMATION_MESSAGE);
0
 
girionisCommented:
Hi javamate06

yes you can change the title, you should use this

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


Cheers
0
 
enachemcCommented:
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.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
javamate06Author Commented:
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.


0
 
enachemcCommented:
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.
0
 
girionisCommented:
:)
0
All Courses

From novice to tech pro — start learning today.