Example usage for java.awt.event ItemEvent getSource

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

Introduction

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

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:misc.ActionDemo.java

public void itemStateChanged(ItemEvent e) {
    JCheckBoxMenuItem mi = (JCheckBoxMenuItem) (e.getSource());
    boolean selected = (e.getStateChange() == ItemEvent.SELECTED);

    //Set the enabled state of the appropriate Action.
    if (mi == cbmi[0]) {
        leftAction.setEnabled(selected);
    } else if (mi == cbmi[1]) {
        middleAction.setEnabled(selected);
    } else if (mi == cbmi[2]) {
        rightAction.setEnabled(selected);
    }//from  w  w  w .ja  va  2  s.c  o  m
}

From source file:org.mbs3.juniuploader.gui.pnlFormVariables.java

private void cmbFormGroupsItemStateChanged(ItemEvent evt) {
    if (evt.getSource() == this.cmbFormGroups) {
        int sel = this.cmbFormGroups.getSelectedIndex();
        if (sel != -1) {
            FormPairGroup fpg = (FormPairGroup) frmMain.formGroups.getElementAt(sel);
            frmMain.formPairValues = new DefaultComboBoxModel(fpg.getPairs());
            this.lstFormPairValues.setModel(frmMain.formPairValues);
            this.lstFormPairValues.invalidate();
        } else {/*  w w w .  j  a  v a 2s. c  o m*/
            frmMain.formPairValues = new DefaultComboBoxModel();
            this.lstFormPairValues.setModel(frmMain.formPairValues);
            this.lstFormPairValues.invalidate();
        }
    }
}

From source file:org.apache.jmeter.protocol.system.gui.SystemSamplerGui.java

@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getSource() == checkReturnCode) {
        desiredReturnCode.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
    }/*from   w w w  .  j  ava 2  s  .  co m*/
}

From source file:assign3.client.WaypointClient.java

public void itemStateChanged(ItemEvent event) {
    if (event.getStateChange() == ItemEvent.SELECTED) {
        Object comp = event.getSource();
        debug("Selection event generated by " + ((comp == frWps) ? "from " : "to ") + "combobox. "
                + "Selected waypoint is: " + (String) event.getItem());
        String To = "to waypoint";
        String From = "from waypoint";
        String currentSelection;//from w  w  w.j  ava 2s  . c  om
        if (comp == frWps) {
            currentSelection = frWps.getSelectedItem().toString();
        } else {
            currentSelection = toWps.getSelectedItem().toString();
        }
        if ((currentSelection == "from waypoint") || (currentSelection == "to waypoint")) {
            latIn.setText("null");
            lonIn.setText("null");
            eleIn.setText("null");
            nameIn.setText("null");
            addrIn.setText("null");
        } else {
            try {
                Waypoint currentWaypoint = server.get(currentSelection);
                //System.out.println("Description Changed: "+server.get(currentSelection));
                latIn.setText(String.valueOf(currentWaypoint.getLat()));
                lonIn.setText(String.valueOf(currentWaypoint.getLon()));
                eleIn.setText(String.valueOf(currentWaypoint.getEle()));
                nameIn.setText(currentWaypoint.getName());
                addrIn.setText(currentWaypoint.getAddr());
            } catch (RemoteException e) {
                System.out.println("Error retrieving name from server.");
            }
        }
    }
}

From source file:de.burrotinto.jKabel.dispalyAS.DisplayAAS.java

@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getSource() == edit) {
        System.out.println("EDIT");
    } else if (e.getSource() == search) {
        System.out.println("Suchen");

    }//from   w  w  w  .  j a va  2s  .com
}

From source file:org.csml.tommo.sugar.modules.heatmap.MixedHeatmapDialog.java

public MixOperationComboBox createMixOperationComboBox() {
    MixOperationComboBox comboBox = new MixOperationComboBox();
    comboBox.addItemListener(new ItemListener() {
        @Override// ww w.j av a 2s.  c  o m
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                MixOperationComboBox box = (MixOperationComboBox) e.getSource();
                double param = mixOperation.getParameter();
                IMixOperation newMixOperation = box.getSelectedItem().getMixer();
                newMixOperation.setParameter(param);
                updateMixOperation(newMixOperation);
            }
        }
    });
    return comboBox;
}

From source file:ParallelPrint.java

/** This will be called from either of the JComboBoxen when the
 * user selects any given item.// w ww  .  ja  v a  2  s.  co  m
 */
public void itemStateChanged(ItemEvent e) {
    // Get the name
    selectedPortName = (String) ((JComboBox) e.getSource()).getSelectedItem();
    // Get the given CommPortIdentifier
    selectedPortIdentifier = (CommPortIdentifier) map.get(selectedPortName);
    // Display the name.
    choice.setText(selectedPortName);
}

From source file:org.yccheok.jstock.gui.NewBrokingFirmJDialog.java

private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged
    JCheckBox me = (JCheckBox) evt.getSource();

    if (me.isSelected() && (this.logo == null)) {
        this.letUserSelectAnImage();
        if (this.logo == null) {
            this.jCheckBox1.setSelected(false);
        }/*from   w  ww . j a v  a  2s .  c  o m*/
    }
}

From source file:com.sec.ose.osi.ui.frm.main.manage.ManagedProjectTableModel.java

public void itemStateChanged(ItemEvent e) {
    Object source = e.getSource();
    if (source instanceof AbstractButton == false)
        return;/*from  w  ww  . j a va  2  s . c o m*/

    boolean checked = e.getStateChange() == ItemEvent.SELECTED;
    if (checked == false) {
        TableModel tm = table.getModel();
        if (tm instanceof AddProjectTableModel) {
            AddProjectTableModel model = (AddProjectTableModel) tm;
            if (model.isHeaderWork())
                return;
        } else if (tm instanceof ManagedProjectTableModel) {
            ManagedProjectTableModel model = (ManagedProjectTableModel) tm;
            if (model.isHeaderWork())
                return;
        }
    }

    for (int x = 0, y = table.getRowCount(); x < y; x++) {
        table.setValueAt(checked, x, column);
    }
}

From source file:is.iclt.jcorpald.CorpaldView.java

public void itemStateChanged(ItemEvent event) {
    if (event.getSource() == chkNodesOnly) {
        controller.setNodesOnly(chkNodesOnly.isSelected());
    } else if (event.getSource() == chkRemoveNodes) {
        controller.setRemoveNodes(chkRemoveNodes.isSelected());
    }/* w w w .j a v a2s .  c o  m*/

}