Custom dialog using JOptionPane API won't dispose
问题 I've been just playing with JOptionPane API to show a custom dialog and I've found a strange situation: when I choose either OK or Cancel option or press Esc key this dialog won't dispose as expected. The thing is, instead of using this single line to display a modal dialog: JOptionPane.showConfirmDialog( null , "The quick brown fox jumps over the lazy dog." , "New Dialog" , JOptionPane.OK_CANCEL_OPTION , JOptionPane.PLAIN_MESSAGE); I wanted to use the API, setting all the parameters one by