Search in sources :

Example 1 with PeriodicTableDialog

use of net.sf.mzmine.util.dialogs.PeriodicTableDialog in project mzmine2 by mzmine.

the class ElementsTableComponent method actionPerformed.

public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();
    if (src == addElementButton) {
        JFrame parent = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, this);
        PeriodicTableDialog dialog = new PeriodicTableDialog(parent);
        dialog.setVisible(true);
        IIsotope chosenIsotope = dialog.getSelectedIsotope();
        if (chosenIsotope == null)
            return;
        elementsTableModel.addRow(chosenIsotope, 0, 100);
    }
    if (src == removeElementButton) {
        int selectedRow = elementsTable.getSelectedRow();
        if (selectedRow < 0)
            return;
        elementsTableModel.removeRow(selectedRow);
    }
}
Also used : IIsotope(org.openscience.cdk.interfaces.IIsotope) JFrame(javax.swing.JFrame) PeriodicTableDialog(net.sf.mzmine.util.dialogs.PeriodicTableDialog)

Aggregations

JFrame (javax.swing.JFrame)1 PeriodicTableDialog (net.sf.mzmine.util.dialogs.PeriodicTableDialog)1 IIsotope (org.openscience.cdk.interfaces.IIsotope)1