"You can use:
javax.swing.UIManager.getIcon("OptionPane.informationIcon");
to access the JOptionPane icons. Depending upon which L&F you're using, you may get different versions of the icon.
Some other icons are:
1. OptionPane.errorIcon
2. OptionPane.informationIcon
3. OptionPane.warningIcon
4. OptionPane.questionIcon
Here's a sample applet:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Icon extends JApplet
{
public void init()
{
Container content = getContentPane();
JLabel label = new JLabel(javax.swing.UIManager.getIcon("OptionPane.informationIcon"));
content.add(label, BorderLayout.CENTER);
}
}
Hope this helps!!"
Quoted from:
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=000121
import javax.swing.*;
public class IconExample implements Runnable {
public void run() {
String[] names = {"error", "information", "question", "warning"};
JPanel p = new JPanel();
for(String name : names) {
Icon icon = UIManager.getIcon("OptionPane." + name + "Icon");
p.add(new JLabel(name, icon, SwingConstants.RIGHT));
}
JFrame f = new JFrame("IconExample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(p);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new IconExample());
}
}