[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 789
  • Last Modified:

Changing icon image of JDialog.

Hi,

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

Thanks.

Bye,

Ajit.
0
ajit_kamat
Asked:
ajit_kamat
1 Solution
 
Jim CakalicSenior Developer/ArchitectCommented:
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

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now