String[] choices = new String[] {"Keep Changes", "Revert to Original", "Place Changed Version on Clipboard" }; int choice; do { choice = JOptionPane.showOptionDialog ((Component) null, "What do you wish to do with the changed copy of the Patch?", "Save Changes?", JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]); } while (choice == JOptionPane.CLOSED_OPTION); if (choice == 0) { if (bankFrame != null) bankFrame.myModel.setPatchAt(p, patchRow, patchCol); } else { if (choice == 2)  copySelectedPatch();  p.useSysexFromPatch(originalPatch); }
frameClosing();
                public void JSLFrameClosing(JSLFrameEvent e) {                    String[] choices = new String[] {"Keep Changes",                                                     "Revert to Original",                                                     "Place Changed Version on Clipboard"                    };                    int choice;                    do {                        choice = JOptionPane.showOptionDialog                            ((Component) null,                             "What do you wish to do with the changed copy of the Patch?",                             "Save Changes?",                             JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE,                             null, choices, choices[0]);                    } while (choice == JOptionPane.CLOSED_OPTION);                    if (choice == 0) { // "Keep Changes"                        if (bankFrame != null)                            bankFrame.myModel.setPatchAt(p, patchRow, patchCol);                    } else {                        if (choice == 2) // "Place Changed Version on Clipboard"                            //put on clipboard but don't 'return' just yet                            copySelectedPatch();                        //restore backup                        p.useSysexFromPatch(originalPatch);                    }                }