How can I dismiss one JOptionPane upon emergence of another JOptionPane in the GUI
问题 As you have seen from my subject above, I would like to know how can I dismiss a JOptionPane which became irrelevant because of another JOptionPane and because the user ,for some reason, didn't dismiss the first one by himself clicking ok button (for example). I've seen some ware in other site similar question, and people suggested to do simply: JOptionPane.getRootFrame().dispose(); But how can I store a reference for each JOptionPane I have and to be able to dismiss only that wanted one.