Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Change the Title Icon of JoptionPane/dialog

 
Ravi Sinha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic