wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes How To Change the Title Icon of JoptionPane/dialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How To Change the Title Icon of JoptionPane/dialog" Watch "How To Change the Title Icon of JoptionPane/dialog" New topic
Author

How To Change the Title Icon of JoptionPane/dialog

Ravi Sinha
Greenhorn

Joined: Nov 04, 2003
Posts: 13
Hi There!
There is code for chaning the title Icon of Frame:
ImageIcon image = new ImageIcon("hello.gif");
JOptionPane.setIcon(image.getImage());
But i want to change the Title Icon of Joptionpane or Dialog? How can i chane it. pleeez give code for this.
Thanks
ravi
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

JDialogs (and I assume JOptionPane, since they are internally using JDialog), use the icon from the frame that is their parent. So you just need to set the icon on the parent frame and then pass the frame into the constructor of the JDialog for the JDialog to use the same icon.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How To Change the Title Icon of JoptionPane/dialog
 
Similar Threads
JOptionPane
How to specify size for a JOptionpane showOptionDialog
tray icon is not displaying
setting icon in joptionpane title bar
Adding an Image to a Panel