}); addJSLFrameListener(new JSLFrameListener() { public void JSLFrameClosing(JSLFrameEvent e) { String[] choices = new String[] {"Keep Changes", "Revert to Original", "Place Changed Version on Clipboard" }; int choice = JOptionPane.CLOSED_OPTION; while (choice == JOptionPane.CLOSED_OPTION) 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]); if (choice == 0) { if (bankFrame != null) bankFrame.myModel.setPatchAt(p, patchRow, patchCol); return; } if (choice == 2)  copySelectedPatch();  System.arraycopy(originalPatch, 0, p.sysex, 0, p.sysex.length); }
}); addJSLFrameListener(new JSLFrameListener() { public void JSLFrameClosing(JSLFrameEvent e) { String[] choices = new String[] {"Keep Changes", "Revert to Original", "Place Changed Version on Clipboard" }; int choice = JOptionPane.CLOSED_OPTION; while (choice == JOptionPane.CLOSED_OPTION) 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]); if (choice == 0) { if (bankFrame != null) bankFrame.myModel.setPatchAt(p, patchRow, patchCol); return; } if (choice == 2)  copySelectedPatch(); p.useSysexFromPatch(originalPatch);  }
    protected PatchEditorFrame(String name, Patch patch) {	// create a resizable, closable, maximizable, and iconifiable frame.	super(name, true, true, true, true);	p = patch;	// make a backup copy	originalPatch = new byte[p.sysex.length];	System.arraycopy(p.sysex, 0, originalPatch, 0, p.sysex.length);	gbc = new GridBagConstraints();	scrollPane = new JPanel();	scrollPane.setLayout(new GridBagLayout());	scrollPane.setSize(600, 400);	scroller = new JScrollPane(scrollPane);	getContentPane().add(scroller);	setSize(600, 400);	moveToDefaultLocation();	faderInEnable(PatchEdit.appConfig.getFaderEnable());	scroller.getVerticalScrollBar().addMouseListener(new MouseAdapter() {		public void mousePressed(MouseEvent e) {		}		public void mouseReleased(MouseEvent e) {                    repaint();                }	    });	scroller.getHorizontalScrollBar().addMouseListener(new MouseAdapter() {		public void mousePressed(MouseEvent e) {		}		public void mouseReleased(MouseEvent e) {                    repaint();                }	    });	addJSLFrameListener(new JSLFrameListener() {		public void JSLFrameClosing(JSLFrameEvent e) {		    String[] choices = new String[] {"Keep Changes",						     "Revert to Original",						     "Place Changed Version on Clipboard"		    };		    int choice = JOptionPane.CLOSED_OPTION;		    while (choice == JOptionPane.CLOSED_OPTION)			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]);		    if (choice == 0) { // "Keep Changes"			if (bankFrame != null)			    bankFrame.myModel.setPatchAt(p, patchRow, patchCol);			return;		    }		    if (choice == 2) // "Place Changed Version on Clipboard"			//put on clipboard but don't 'return' just yet			copySelectedPatch();		    //restore backup		    System.arraycopy(originalPatch, 0, p.sysex, 0, p.sysex.length);		}		public void JSLFrameOpened(JSLFrameEvent e) {		}		public void JSLFrameActivated(JSLFrameEvent e) {		    p.getDriver().calculateChecksum(p);		    p.getDriver().sendPatch(p);		    gotFocus();		    Actions.setEnabled(false,				       Actions.EN_GET				       | Actions.EN_PASTE);		    Actions.setEnabled(true,				       Actions.EN_COPY				       | Actions.EN_EXPORT				       | Actions.EN_PLAY				       | Actions.EN_REASSIGN				       | Actions.EN_SEND				       | Actions.EN_SEND_TO				       | Actions.EN_STORE);		}		public void JSLFrameClosed(JSLFrameEvent e) {		}		public void JSLFrameDeactivated(JSLFrameEvent e) {		    Actions.setEnabled(false,				       Actions.EN_COPY				       | Actions.EN_EXPORT				       | Actions.EN_PLAY				       | Actions.EN_REASSIGN				       | Actions.EN_SEND				       | Actions.EN_SEND_TO				       | Actions.EN_STORE);		    lostFocus();		}		public void JSLFrameDeiconified(JSLFrameEvent e) {		}		public void JSLFrameIconified(JSLFrameEvent e) {		}	    });    }