This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane" Watch "JOptionPane" New topic


Rick Rodriguez
Ranch Hand

Joined: Jun 02, 2001
Posts: 44
How do I change the icon for the JOptionPane?
I know how to change the "message icon", i.e. ERROR_MESSAGE, INFORMATION_MESSAGE, etc.
I am curious about how to change the "little cup of coffee" in the upper left hand corner of the JOptionPane box.
Any feedback would be most welcomed. Thanks!
Bill Liteplo
Ranch Hand

Joined: Oct 16, 2002
Posts: 88
I'm not sure how you are showing the JOptionPane, but try this.
Rick Rodriguez
Ranch Hand

Joined: Jun 02, 2001
Posts: 44
Actually, I figured out how to make it use my "Frame's" icon. I just utilize the "this" keyword for the first argument:

The "this" keyword solved my problems. Thanks for your help!
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Moving this to Swing.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
subject: JOptionPane
Similar Threads
Question about JOptionPane
How To Change the Title Icon of JoptionPane/dialog
Is possible change icon of Ok's botton in JOPtionPane, How?
Changing bgcolor of JOptionPane