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:temp1.JFrame1.java

private void jToggleButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton6ActionPerformed
    AbstractButton abstractButton = (AbstractButton) evt.getSource();
    boolean selected = abstractButton.getModel().isSelected();
    if (!selected)
        c3 = selected;// w w w. j a v  a2s.  c om
    if (selected)
        c3 = selected;
}

From source file:temp1.JFrame1.java

private void jToggleButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton7ActionPerformed
    AbstractButton abstractButton = (AbstractButton) evt.getSource();
    boolean selected = abstractButton.getModel().isSelected();
    if (!selected)
        c4 = selected;/*  w w  w  .  j a v  a2 s.c om*/
    if (selected)
        c4 = selected;
}

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private JComboBox createFilterCombo(JComboBox filtersCombo) {
    FiltersType filtersType = viewerConfig.getFilters();
    // filtersCombo = new JComboBox();
    if (filtersType == null)
        return filtersCombo;
    java.util.List<FilterType> filters = filtersType.getFilter();
    final Map<String, FilterType> filterName2FilterType = new HashMap<String, FilterType>();

    for (FilterType filter : filters) {
        filtersCombo.addItem(filter.getName());
        filterName2FilterType.put(filter.getName(), filter);
    }/*  w  w  w.j av a2  s  .co m*/
    filtersCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String filterName = (String) ((JComboBox) e.getSource()).getSelectedItem();
            currentFilter = filterName2FilterType.get(filterName);
            vv.setCurrentFilter(currentFilter);
            //                Set<String> vertexes = new HashSet<String>(currentGraph.getVertices());
            Set<String> pickedVertexes = getPickedVerteces();
            if (pickedVertexes != null) {
                applyFilter(currentFilter, currentHops, pickedVertexes);
            } else {
                applyFilter(currentFilter, currentHops);
            }
        }
    });
    final String filterName = (String) filtersCombo.getSelectedItem();
    currentFilter = filterName2FilterType.get(filterName);
    vv.setCurrentFilter(currentFilter);
    return filtersCombo;
}

From source file:tracing.ShollAnalysisDialog.java

public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    ShollResults results = null;/*from  w  w  w.  ja  va 2 s  . c o  m*/
    synchronized (this) {
        results = getCurrentResults();
    }
    if (results == null) {
        IJ.error("The sphere separation field must be a number, not '" + sampleSeparation.getText() + "'");
        return;
    }
    if (source == makeShollImageButton) {
        results.makeShollCrossingsImagePlus(originalImage);
    } else if (source == exportDetailAsCSVButton || source == exportSummaryAsCSVButton) {

        boolean detail = (source == exportDetailAsCSVButton);

        SaveDialog sd = new SaveDialog("Export data as...",
                "sholl-" + (detail ? "detail" : "summary") + results.getSuggestedSuffix(), ".csv");

        if (sd.getFileName() == null) {
            return;
        }

        File saveFile = new File(sd.getDirectory(), sd.getFileName());
        if ((saveFile != null) && saveFile.exists()) {
            if (!IJ.showMessageWithCancel("Export data...", "The file " + saveFile.getAbsolutePath()
                    + " already exists.\n" + "Do you want to replace it?"))
                return;
        }

        IJ.showStatus("Exporting CSV data to " + saveFile.getAbsolutePath());

        try {
            if (detail)
                results.exportDetailToCSV(saveFile);
            else
                results.exportSummaryToCSV(saveFile);
        } catch (IOException ioe) {
            IJ.error("Saving to " + saveFile.getAbsolutePath() + " failed");
            return;
        }

    } else if (source == drawShollGraphButton) {
        graphFrame.setVisible(true);
    } else if (source == addToResultsTableButton) {
        results.addToResultsTable();
    }
}

From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java

public void actionPerformed(ActionEvent e) {
    if (startButton == e.getSource()) {
        startTransformation();/*from w  w  w.j  a v  a 2 s .  co m*/
    } else if (e.getSource() == viewLogButton) {
        try {
            if (Desktop.isDesktopSupported())
                Desktop.getDesktop().open(logfile);
            else if (SystemUtils.IS_OS_WINDOWS)
                Runtime.getRuntime().exec("cmd /c start " + logfile.getPath());
            else
                Runtime.getRuntime().exec("open " + logfile.getPath());
        } catch (Exception e1) {
            e1.printStackTrace();
            System.exit(1);
        }
    } else if (e.getSource() == exitButton) {
        closeDialog();
    }
}

From source file:de.tor.tribes.ui.views.DSWorkbenchTagFrame.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("Paste")) {
        pasteVillagesFromClipboard();/*from www.  j a v  a2  s  . c  o m*/
    } else if (e.getActionCommand().equals("BBCopy")) {
        transferSelectedTagsAsBBCodesToClipboard();
    } else if (e.getActionCommand().equals("BBCopy_Village")) {
        copyVillageAsBBCode();
    } else if (e.getActionCommand().equals("Delete")) {
        if (e.getSource() != null) {
            if (jTagsTable.hasFocus()) {
                removeSelectedTags();
            } else {
                untagSelectedVillages();
            }
        }
    }
}

From source file:lejos.pc.charting.LogChartFrame.java

private void domainDisplayLimitRadioButton_actionPerformed(ActionEvent e) {
    if (e.getSource() == useTimeRadioButton) {
        domainDisplayLimitSlider.setMaximum(MAXDOMAIN_TIME_LIMIT);
        domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT);
        domainDisplayLimitSlider.setValue(MAXDOMAIN_TIME_LIMIT);
    } else if (e.getSource() == useDataPointsRadioButton) {
        domainDisplayLimitSlider.setMaximum(MAXDOMAIN_DATAPOINT_LIMIT);
        domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT);
        domainDisplayLimitSlider.setValue(MAXDOMAIN_DATAPOINT_LIMIT);
    }/* w ww .  j av  a  2  s.  c o m*/

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void classComboActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_classComboActionPerformed
{//GEN-HEADEREND:event_classComboActionPerformed

    JComboBox src = (JComboBox) evt.getSource();

    this.parameters.setSpectralClass((String) (src.getModel().getSelectedItem()));

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void lumClassComboActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_lumClassComboActionPerformed
{//GEN-HEADEREND:event_lumClassComboActionPerformed

    JComboBox src = (JComboBox) evt.getSource();

    this.parameters.setLuminosityClass((String) (src.getModel().getSelectedItem()));

}