How to display an icon on JOptionPane.showInputDialog() in Java?

Posted by Lion on Stack Overflow See other posts from Stack Overflow or by Lion
Published on 2011-11-20T08:52:19Z Indexed on 2011/11/20 9:51 UTC
Read the original article Hit count: 210

Filed under:
|

The following segment of code shows JOptionPane.showInputDialog() method. It works fine but I need 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?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing