Info icon

I would like to use the regular JDialog icon information provided by JOptionPane.INFORMATION_MESSAGE. Is it possible?

+5
source share
1 answer

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

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

Outside of the UI code, you just need to call:

UIManager.getIcon("OptionPane.informationIcon")

Note that the returned icon depends on the current Look and Feel.


Out of curiosity, other resources:

  • "OptionPane.errorIcon"
  • "OptionPane.warningIcon"
  • "OptionPane.questionIcon"
+8
source

All Articles