Search code examples
javaswingjoptionpane

How to remove question mark in a JOptionPane?


How can I get rid of any marks at the left top corner of a JOptionPane?

int result = JOptionPane.showConfirmDialog(null, myPanel, 
                   "Please Enter X and Y Values", JOptionPane.OK_CANCEL_OPTION);

This works fine, but I want to remove the nasty ? at the left top corner.


Solution

  • Use the PLAIN_MESSAGE message type

    JOptionPane.showConfirmDialog(null, "Help",
        "Please Enter X and Y Values", 
        JOptionPane.OK_CANCEL_OPTION, 
        JOptionPane.PLAIN_MESSAGE);
    

    enter image description here