Solved

JOptionPane Parameters

Posted on 2006-07-18
6
785 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 30 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

617 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