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"
source
share