File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring 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
I agree. Here's the link:
subject: JOptionPane
It's not a secret anymore!