Search code examples
javaswingjoptionpane

JOptionPane : change the Icon


I have this layout in the JOptionPane:

JCheckBox checkbox = new JCheckBox("Do not show this message again.");
String message = "Level loaded successfully";  
Object[] params = {message, checkbox};  
int n = JOptionPane.showConfirmDialog(p, params, "Draft saving",
     JOptionPane.PLAIN_MESSAGE);  

everything is fine except for the display of the Icon..,

Ideally I would like not to have an Icon (hence the JOptionPane.PLAIN_MESSAGE), but I get a default Icon.

How can I change this ?

Jason


Solution

  • Use the version of the method that takes an icon parameter, and pass in null for the icon.