The following segment of code shows JOptionPane.showInputDialog() method. It works fine, Now I want to display a custom icon on it. I currently left it null as shown below.
String operatingSystem = System.getProperty("os.name");
Object o[] = {"Turn Off", "Restart", "Stand By", "Log Off"};
Frame frame = new Frame(operatingSystem);
Object selectedValue = JOptionPane.showInputDialog(frame,
"What would you like to do with the system?", "Select a task",
JOptionPane.INFORMATION_MESSAGE, null, o, o[0]); //<---- Here it is.
How can an icon be displayed on it replacing null?
Swing provides a particularly useful implementation of the Icon interface: ImageIcon, which paints an icon from a GIF, JPEG, or PNG image.
Here is a tutorial for you : How to Use Icons
When youre done creating the icon, simply replace the
nullwith your Icon. Done!