Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the TitleBar icon of a JOptionPane

Status
Not open for further replies.

milage

Programmer
Jul 13, 2001
58
US
Hi,

I am trying to set the titlebar icon of a JOptionPane to my program's icon but have only succeeded in setting the internal icon (the one often set to a stop sign or exclaimation mark etc).

Is there any way of setting the titlebar icon of a JOptionPane?

Cheers

Milage
 
I honestly don't think that you can do this. Typically you can only set the icon of a window if it is some form of JFrame. Since JOptionPane only extends JComponent, there seems to be no programmatic way of changing the dialog box's window icon.

You would have to create your own dialog box with buttons if you absolutely require this behavior.

Best,
Adam Rice
 
Hi,

Right, I haven't found a solution but it appears that if you declare and option pane from a JFrame then it uses the same icon as that of the parent JFrame. However, if you declare an option pane from another class which does not extend a JFrame it will have a default Java Icon.

Cheers

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top