JOptionPane Parameters

Posted on 2006-07-18
Last Modified: 2012-08-14
The title in the


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“?
Question by:javamate06
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
LVL 35

Expert Comment

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)

LVL 12

Expert Comment

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.

Author Comment

ID: 17129531
Thank you...

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

and specifically in


parameter I have an error which expecting identifier.

Please, how to call this to show the message.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 12

Expert Comment

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.
LVL 35

Accepted Solution

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

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

Expert Comment

ID: 17129643

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
going to wrong jsp page 2 69
Glassfish admin console not working 1 88
jmeter usage 4 63
junit example issue 2 56
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

734 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