Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JOptionPane Parameters

Posted on 2006-07-18
6
Medium Priority
?
792 Views
Last Modified: 2012-08-14
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“?
0
Comment
Question by:javamate06
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 17129477
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
 
LVL 12

Expert Comment

by:enachemc
ID: 17129493
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
 

Author Comment

by:javamate06
ID: 17129531
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 12

Expert Comment

by:enachemc
ID: 17129543
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
 
LVL 35

Accepted Solution

by:
girionis earned 120 total points
ID: 17129554
YOu should call it like:

JOptionPane.showMessageDialog(this, "HI", "My title", JOptionPane.INFORMATION_MESSAGE);
0
 
LVL 35

Expert Comment

by:girionis
ID: 17129643
:)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question