Solved

Changing icon image of JDialog.

Posted on 2000-04-01
1
772 Views
Last Modified: 2008-02-01
Hi,

How to change the icon image on the left handside of the title bar of a JDialog instance?

Thanks.

Bye,

Ajit.
0
Comment
Question by:ajit_kamat
1 Comment
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 50 total points
ID: 2676069
JDialog appears to inherit the titlebar icon image from its owner JFrame. You set a frame as the dialog owner by using the appropriate JDialog constructor. If your current JFrame already has the icon image your want (using setIconImage()), no problem. If not, you can create a dummy JFrame, set its image, and make this the owner of the JDialog.

JFrame dummyFrame = new JFrame();
ImageIcon icon = new ImageIcon( ....... );
dummyFrame.setIconImage( icon.getImage() );
JDialog dialog = new JDialog(dummyFrame, ...);

Best regards,
Jim Cakalic
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now