6

I would like to make use in a normal JDialog of the information icon provided by the JOptionPane.INFORMATION_MESSAGE. Is it possible?

Anto
  • 4,265
  • 14
  • 63
  • 113
  • Related question: http://stackoverflow.com/questions/1196797/where-are-these-icons-as-a-java-resource – Gnoupi Jun 28 '10 at 14:43

1 Answers1

9

Currently in the JOptionPane source code (rather in its UI, actually), this is done by retrieving this property:

return (Icon)DefaultLookup.get(optionPane, this, "OptionPane.informationIcon");

Outside of a UI code, though, you simply need to call:

UIManager.getIcon("OptionPane.informationIcon")

Note however that the icon returned depends on the current Look & Feel.


Out of curiosity, the other resources are:

  • "OptionPane.errorIcon"
  • "OptionPane.warningIcon"
  • "OptionPane.questionIcon"
Gnoupi
  • 4,715
  • 5
  • 34
  • 50