Example usage for java.awt.event ActionEvent getSource

List of usage examples for java.awt.event ActionEvent getSource

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:de.tud.kom.p2psim.impl.skynet.visualization.MetricsPlot.java

@Override
public void actionPerformed(ActionEvent e) {
    JRadioButton button = (JRadioButton) e.getSource();
    if (button.isSelected()) {
        if (e.getActionCommand().equals("Min-Values")) {
            showMin = true;//from  www.java2  s.c  om
        } else if (e.getActionCommand().equals("Max-Values")) {
            showMax = true;
        } else {
            showSdtDev = true;
        }
    } else {
        if (e.getActionCommand().equals("Min-Values")) {
            showMin = false;
        } else if (e.getActionCommand().equals("Max-Values")) {
            showMax = false;
        } else {
            showSdtDev = false;
        }
    }
}

From source file:guineu.util.dialogs.AxesSetupDialog.java

/**
 * Implementation for ActionListener interface
 *//* www.j  a v  a2 s  . com*/
public void actionPerformed(ActionEvent ae) {

    Object src = ae.getSource();

    if (src == btnOK) {
        if (setValuesToPlot()) {
            exitCode = ExitCode.OK;
            dispose();
        }
    }

    if (src == btnApply) {
        if (setValuesToPlot()) {
            getValuesToControls();
        }
    }

    if (src == btnCancel) {
        exitCode = ExitCode.CANCEL;
        dispose();
    }

    if ((src == checkXAutoRange) || (src == checkYAutoRange) | (src == checkXAutoTick)
            || (src == checkYAutoTick)) {
        updateAutoRangeAvailability();
    }

}

From source file:net.sf.mzmine.util.dialogs.AxesSetupDialog.java

/**
 * Implementation for ActionListener interface
 *//*from  w ww  .java  2  s.c  o  m*/
public void actionPerformed(ActionEvent ae) {

    Object src = ae.getSource();

    if (src == btnOK) {
        if (setValuesToPlot()) {
            exitCode = ExitCode.OK;
            dispose();
        }
    }

    if (src == btnApply) {
        if (setValuesToPlot())
            getValuesToControls();
    }

    if (src == btnCancel) {
        exitCode = ExitCode.CANCEL;
        dispose();
    }

    if ((src == checkXAutoRange) || (src == checkYAutoRange) | (src == checkXAutoTick)
            || (src == checkYAutoTick))
        updateAutoRangeAvailability();

}

From source file:net.sf.mzmine.modules.visualization.ida.IDABottomPanel.java

@Override
public void actionPerformed(ActionEvent e) {

    Object src = e.getSource();

    if (src == thresholdCombo) {

        PeakThresholdMode mode = (PeakThresholdMode) this.thresholdCombo.getSelectedItem();

        switch (mode) {
        case ABOVE_INTENSITY_PEAKS:
            peakTextField.setText(String.valueOf(thresholdSettings.getIntensityThreshold()));
            peakTextField.setEnabled(true);
            break;
        case ALL_PEAKS:
            peakTextField.setEnabled(false);
            break;
        case TOP_PEAKS:
        case TOP_PEAKS_AREA:
            peakTextField.setText(String.valueOf(thresholdSettings.getTopPeaksThreshold()));
            peakTextField.setEnabled(true);
            break;
        }//  ww w .  j ava  2  s .  c  o m

        thresholdSettings.setMode(mode);

    }

    if (src == peakTextField) {
        PeakThresholdMode mode = (PeakThresholdMode) this.thresholdCombo.getSelectedItem();
        String value = peakTextField.getText();
        switch (mode) {
        case ABOVE_INTENSITY_PEAKS:
            double topInt = Double.parseDouble(value);
            thresholdSettings.setIntensityThreshold(topInt);
            break;
        case TOP_PEAKS:
        case TOP_PEAKS_AREA:
            int topPeaks = Integer.parseInt(value);
            thresholdSettings.setTopPeaksThreshold(topPeaks);
            break;
        default:
            break;
        }
    }

    PeakList selectedPeakList = getPeaksInThreshold();
    if (selectedPeakList != null)
        masterFrame.getPlot().loadPeakList(selectedPeakList);

}

From source file:de.freese.base.swing.mac_os_x.MyApp.java

/**
 * @see/*from  w  w  w  .ja v  a  2  s .co m*/
 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
@Override
public void actionPerformed(final ActionEvent e) {
    Object source = e.getSource();

    if (source == this.quitMI) {
        quit();
    } else {
        if (source == this.optionsMI) {
            preferences();
        } else {
            if (source == this.aboutMI) {
                about();
            } else {
                if (source == this.openMI) {
                    // File:Open action shows a FileDialog for loading displayable images
                    FileDialog openDialog = new FileDialog(this);
                    openDialog.setMode(FileDialog.LOAD);
                    openDialog.setFilenameFilter(new FilenameFilter() {
                        /**
                         * @see java.io.FilenameFilter#accept(java.io.File,
                         * java.lang.String)
                         */
                        @Override
                        public boolean accept(final File dir, final String name) {
                            String[] supportedFiles = ImageIO.getReaderFormatNames();

                            for (String supportedFile : supportedFiles) {
                                if (name.endsWith(supportedFile)) {
                                    return true;
                                }
                            }

                            return false;
                        }
                    });

                    openDialog.setVisible(true);
                    String filePath = openDialog.getDirectory() + openDialog.getFile();

                    if (filePath.length() > 0) {
                        loadImageFile(filePath);
                    }
                }
            }
        }
    }
}

From source file:fi.marketing.list.ui.DashboardUI.java

private void addContactListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addContactListButtonActionPerformed
    if (evt.getSource() == addContactListButton && jTextField1.getText().endsWith(".txt")) {
        InputStream is = getClass().getClassLoader().getResourceAsStream(jTextField1.getText());
        FileReader just = oper.fileReaderInputStream(is);
        long startTime = System.currentTimeMillis();
        oper.matchAContactListToCustomers(just, contactListName.getText());
        long endTime = System.currentTimeMillis();
        infoArea1.setText(oper.printTime(startTime, endTime) + "\n" + "There is " + oper.getContactCountNumber()
                + " rows of contact data to be put on the list " + contactListName.getText() + ".");
        infoAreaStatistics.setText("There are " + oper.getCustomers().numberOfCustomers()
                + " customers in the system. \n Emails: " + oper.getCustomers().getNumberOfEmails()
                + "\n Phone numbers: " + oper.getCustomers().getNumberOfPhoneNumbers());
    }/*from  ww w . j  ava  2 s.  c  o  m*/
}

From source file:fi.marketing.list.ui.DashboardUI.java

private void createMarketingListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createMarketingListButtonActionPerformed
    if (evt.getSource() == createMarketingListButton) {
        if (selectType.getSelectedIndex() == 0) {
            setTextAndType(infoArea2, resultArea, fi.marketing.list.logic.Type.phone);
        } else if (selectType.getSelectedIndex() == 1) {
            setTextAndType(infoArea2, resultArea, fi.marketing.list.logic.Type.email);
        }//  w  ww .j  a va2  s  . c  o m
    }
}

From source file:misc.DesktopDemo.java

private void onChooseFile(ActionEvent evt) {
    if (evt.getSource() == btnFile) {
        int returnVal = fc.showOpenDialog(DesktopDemo.this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            file = fc.getSelectedFile();
            txtFile.setText(file.getAbsolutePath());
        }/*from  w  w  w .j ava  2s  .  c  om*/
    }
}

From source file:MainUI.java

public void actionPerformed(ActionEvent e) {
    if (e.getSource() == hisComboBox) {
        int index = hisComboBox.getSelectedIndex();
    }/* w  ww.  j  a  v  a 2s . c  om*/
}

From source file:utilities.GraphViewer.java

public void actionPerformed(ActionEvent e) {
    // Evenement button parcourir
    if (e.getSource() == this.parcourir) {

        JFileChooser fileopen = new JFileChooser();
        FiltreSimple filter = new FiltreSimple("Fichier res", "res");
        fileopen.addChoosableFileFilter(filter);
        int ret = fileopen.showDialog(null, "Open file");
        if (ret == JFileChooser.APPROVE_OPTION) {
            File file = fileopen.getSelectedFile();
            System.out.println(file.getPath());
            this.addSensor(file.getPath());

        }// www  . java 2 s  .c om

    } else {

        JCheckBox check;
        for (int i = 0; i < this.sensors.size(); i++) {
            check = sensors.get(i);
            if (e.getSource() == check) {
                if (check.isSelected()) {
                    if (!this.isExist(check)) {
                        String s = check.getText();
                        s = s.substring(1);
                        ajouterFichier(this.db.getPath(check.getText()));
                        sensors1.addLast(check);
                        this.graphe.revalidate();
                    }

                } else {
                    this.removeSerie(check.getText());
                    sensors1.remove(check);
                    this.graphe.revalidate();

                }
                break;
            }
        }

    }

}