Collections.sort(((LibraryFrame) JSLDesktop.getSelectedFrame ()).myModel.PatchList, new MyOrder (command)); ((LibraryFrame) JSLDesktop.getSelectedFrame ()).myModel.fireTableDataChanged ();
((LibraryFrame) JSLDesktop.getSelectedFrame()) .sortPatch(new MyOrder(command));
    public SortDialog (JFrame parent) {        super(parent, "Library Sort", true);        JPanel container = new JPanel ();        container.setLayout (new BorderLayout ());        JLabel myLabel = new JLabel ("Please select a Field to Sort the Library by.", JLabel.CENTER);        try {	    container.add (myLabel, BorderLayout.NORTH);	    final ButtonGroup group = new ButtonGroup ();	    JRadioButton button1 = new JRadioButton ("Patch Name");	    button1.setActionCommand ("P");	    JRadioButton button2 = new JRadioButton ("Field 1");	    JRadioButton button4 = new JRadioButton ("Synth Name");	    button4.setActionCommand ("S");	    JRadioButton button5 = new JRadioButton ("Patch Type");	    button5.setActionCommand ("T");	    button2.setActionCommand ("1");	    JRadioButton button3 = new JRadioButton ("Field 2");	    button3.setActionCommand ("2");	    group.add (button1);	    group.add (button4);	    group.add (button5);	    group.add (button2);	    group.add (button3);	    button1.setSelected (true);	    JPanel radioPanel = new JPanel ();	    radioPanel.setLayout (new ColumnLayout ());	    radioPanel.add (button1);	    radioPanel.add (button4);	    radioPanel.add (button5);	    radioPanel.add (button2);	    radioPanel.add (button3);	    container.add (radioPanel, BorderLayout.CENTER);	    JPanel buttonPanel = new JPanel ();	    buttonPanel.setLayout (new FlowLayout());	    JButton done = new JButton (" OK ");	    done.addActionListener (new ActionListener () {		    public void actionPerformed (ActionEvent e) {			setVisible (false);			PatchEdit.showWaitDialog();			String command = group.getSelection ().getActionCommand ();			Collections.sort(((LibraryFrame) JSLDesktop.getSelectedFrame ()).myModel.PatchList,					 new MyOrder (command));			((LibraryFrame) JSLDesktop.getSelectedFrame ()).myModel.fireTableDataChanged ();			PatchEdit.hideWaitDialog();		    }		});	    buttonPanel.add (done);	    JButton cancel = new JButton ("Cancel");	    cancel.addActionListener (new ActionListener () {		    public void actionPerformed (ActionEvent e) {			setVisible (false);		    }		});	    buttonPanel.add (cancel);	    getRootPane ().setDefaultButton (done);	    container.add (buttonPanel, BorderLayout.SOUTH);	    getContentPane ().add (container);	    pack ();	    Utility.centerDialog(this);	} catch (Exception e) {	    ErrorMsg.reportStatus (e);	}    }