Java 类java.awt.event.ItemEvent 实例源码

项目:LivroJavaComoProgramar10Edicao    文件:ComboBoxFrame.java   
public ComboBoxFrame()
{
   super("Testing JComboBox");
   setLayout(new FlowLayout()); // set frame layout     

   imagesJComboBox = new JComboBox<String>(names); // set up JComboBox
   imagesJComboBox.setMaximumRowCount(3); // display three rows

   add(imagesJComboBox); // add combobox to JFrame
   label = new JLabel(icons[0]); // display first icon
   add(label); // add label to JFrame
   imagesJComboBox.addItemListener(event -> { 
        if (event.getStateChange() == ItemEvent.SELECTED)
           label.setIcon(icons[imagesJComboBox.getSelectedIndex()]);
        }); // end call to addItemListener
}
项目:PTEAssistant    文件:UserSettingFrame.java   
private void comboCountry_Change(ItemEvent e) {
    if(comboCountry.getSelectedIndex() > 0) {
        List<Location> locs = locationDao.queryAllLocationsByPid(((Location)comboCountry.getSelectedItem()).id);
        if(locs.isEmpty()) {
            lblState.setVisible(false);
            comboState.setModel(new DefaultComboBoxModel());
            comboState.setVisible(false);
        } else {
            lblState.setVisible(true);
            DefaultComboBoxModel model = new DefaultComboBoxModel();
            model.addElement("请选择...");
            for(Location loc : locs)
                model.addElement(loc);
            comboState.setModel(model);
            comboState.setVisible(true);
        }
    } else {
        lblState.setVisible(false);
        comboState.setModel(new DefaultComboBoxModel());
        comboState.setVisible(false);
    }
}
项目:Laserscan-to-dxf    文件:CheckBoxWithText.java   
/**
 * 
 */
public CheckBoxWithText(String title) {
    super();
    setText(title);
    super.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            // TODO Auto-generated method stub
            if (e.getStateChange() == ItemEvent.SELECTED) {
                textField.setEnabled(true);
            } else if (e.getStateChange() == ItemEvent.DESELECTED) {
                textField.setEnabled(false);
            }
        }

    });
}
项目:VASSAL-src    文件:ReportState.java   
public Ed(ReportState piece) {

      box = new JPanel();
      box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
      descInput = new StringConfigurer(null, "Description:  ", piece.description);
      box.add(descInput.getControls());
      keys = new NamedKeyStrokeArrayConfigurer(null, "Report on these keystrokes:  ", piece.keys);
      box.add(keys.getControls());
      cycle = new JCheckBox("Cycle through different messages?");
      box.add(cycle);
      format = new PlayerIdFormattedStringConfigurer(null, "Report format:  ", new String[]{COMMAND_NAME,
                                                                                         OLD_UNIT_NAME,
                                                                                         NEW_UNIT_NAME,
                                                                                         MAP_NAME,
                                                                                         OLD_MAP_NAME,
                                                                                         LOCATION_NAME,
                                                                                         OLD_LOCATION_NAME});
      format.setValue(piece.reportFormat);
      box.add(format.getControls());
      cycleFormat = new StringArrayConfigurer(null, "Message formats", piece.cycleReportFormat);
      box.add(cycleFormat.getControls());
      cycleDownKeys = new NamedKeyStrokeArrayConfigurer(null, "Report previous message on these keystrokes:  ", piece.cycleDownKeys);
      box.add(cycleDownKeys.getControls());
      ItemListener l = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          format.getControls().setVisible(!cycle.isSelected());
          cycleFormat.getControls().setVisible(cycle.isSelected());
          cycleDownKeys.getControls().setVisible(cycle.isSelected());
          Window w = SwingUtilities.getWindowAncestor(box);
          if (w != null) {
            w.pack();
          }
        }
      };
      l.itemStateChanged(null);
      cycle.addItemListener(l);
      cycle.setSelected(piece.cycleReportFormat.length > 0);
    }
项目:incubator-netbeans    文件:InternationalizationResourceBundleBrandingPanel.java   
private void attachListeners() {
    localeComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(final ItemEvent e) {
            RP.post(new Runnable() {
                @Override
                public void run() {
                    final Set<File> jars = loadPlatformJars();
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            if (e.getStateChange() == ItemEvent.SELECTED) {
                                branding.refreshLocalizedBundles((Locale) e.getItem());
                                prepareTree(jars);
                            }
                        }
                    });
                }
            });
        }
    });
}
项目:FreeCol    文件:ConfirmDeclarationDialog.java   
/**
 * {@inheritDoc}
 */
@Override
public void itemStateChanged(ItemEvent e) {
    Background newBackground
        = (Background)this.background.getSelectedItem();
    Decoration newDecoration
        = (Decoration)this.decoration.getSelectedItem();
    UnionPosition newPosition
        = (UnionPosition)this.unionPosition.getSelectedItem();
    UnionShape newShape
        = (UnionShape)this.unionShape.getSelectedItem();
    this.flag = new Flag(newBackground, newDecoration,
                         newPosition, newShape);
    this.flag.setStars(this.stars.getSelectedIndex() + 1);
    this.flag.setStripes(this.stripes.getSelectedIndex() + 1);
    setColors();
    this.label.setIcon(new ImageIcon(this.flag.getImage()));
}
项目:cuttlefish    文件:ViewMenu.java   
@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getItem() == mouseToolbarCheckbox) {
        toolbars.getMouseToolbar().setVisible(mouseToolbarCheckbox.getState() );            
    } else if (e.getItem() == zoomToolbarCheckbox) {
        toolbars.getZoomToolbar().setVisible(zoomToolbarCheckbox.getState() );
    } else if (e.getItem() == simulationToolbarCheckbox) {
        toolbars.getSimulationToolbar().setVisible(simulationToolbarCheckbox.getState() );
    } else if (e.getItem() == dbToolbarCheckbox) {
        toolbars.getDBToolbar().setVisible(dbToolbarCheckbox.getState() );
    } else if (e.getItem() == undoToolbarCheckbox) {
        toolbars.getUndoToolbar().setVisible(undoToolbarCheckbox.getState());
    } else {
        System.err.println("Unknown event");
    }
}
项目:processing-idea    文件:ProcessingSketchRootSelectStep.java   
private void setupImportRootButtons() {
    if (projectCreationRootOptionButtonGroup.isEmpty()) {
        projectCreationRootOptionButtonGroup.add(importIntoDefaultProjectOption);
        projectCreationRootOptionButtonGroup.add(createProjectInSelectedRootOption);
        projectCreationRootOptionButtonGroup.add(importProjectIntoCustomRootOption);

        for (JRadioButton radioButton : projectCreationRootOptionButtonGroup) {
            if (radioButton == importProjectIntoCustomRootOption) {
                importProjectIntoCustomRootOption.addItemListener(e -> {
                    if (e.getStateChange() == ItemEvent.SELECTED) {
                        customImportRootDirectoryBrowser.setVisible(true);
                        customImportRootDirectoryBrowser.setEnabled(true);
                    } else {
                        customImportRootDirectoryBrowser.setVisible(false);
                        customImportRootDirectoryBrowser.setEnabled(false);
                    }

                    refreshProjectCreationPreview();
                });
            } else {
                radioButton.addItemListener(e -> refreshProjectCreationPreview());
            }
        }
    }
}
项目:AgentWorkbench    文件:JadeSetupMTP.java   
@Override
public void itemStateChanged(ItemEvent event) {
    if ( event.getSource() == jComboBoxMtpProtocol){
        if (this.getJcomboBoxMtpProtocol().getSelectedProtocol()==MtpProtocol.HTTP) {
            // ---- switch to HTTP ----------------------------------
            this.setHttpsComponentsEnabledState(false);
            this.currProject.getJadeConfiguration().setMtpProtocol(MtpProtocol.HTTP);
            this.getJTextFieldKeyStoreFile().setText(null);
            this.getJTextFieldTrustStoreFile().setText(null);
        } else if (this.getJcomboBoxMtpProtocol().getSelectedProtocol()==MtpProtocol.HTTPS) {
            // ---- switch to HTTPS ------------------------------
            this.setHttpsComponentsEnabledState(true);
            this.editHTTPSsettings(event.getSource(), MtpProtocol.HTTPS);
        } else if(this.getJcomboBoxMtpProtocol().getSelectedProtocol()==MtpProtocol.PROXIEDHTTPS){
            this.setHttpsComponentsEnabledState(true);
            this.editHTTPSsettings(event.getSource(), MtpProtocol.PROXIEDHTTPS);
        }
    }
}
项目:ramus    文件:TableViewPreferenciesDialog.java   
@Override
public void itemStateChanged(ItemEvent e) {
    setHButtonEnable();
    if (rec)
        return;
    rec = true;
    try {
        if ((e.getStateChange() == ItemEvent.SELECTED)
                && (hierarchies.getSelectedIndex() == hierarchies
                .getItemCount() - 1)) {
            createNewHierarchy();
        }
    } finally {
        rec = false;
    }
}
项目:openjdk-jdk10    文件:Font2DTest.java   
public void itemStateChanged( ItemEvent e ) {
    Object source = e.getSource();

    if ( source instanceof JCheckBoxMenuItem ) {
        JCheckBoxMenuItem cbmi = (JCheckBoxMenuItem) source;
        if ( cbmi == displayGridCBMI )
          fp.setGridDisplay( displayGridCBMI.getState() );
        else if ( cbmi == force16ColsCBMI )
          fp.setForce16Columns( force16ColsCBMI.getState() );
        else if ( cbmi == showFontInfoCBMI ) {
            if ( showFontInfoCBMI.getState() ) {
                fireUpdateFontInfo();
                fontInfoDialog.show();
            }
            else
              fontInfoDialog.hide();
        }
    }
}
项目:JuggleMasterPro    文件:DataJToggleButton.java   
@Override final public void itemStateChanged(ItemEvent objPitemEvent) {
    Tools.debug("DataJToggleButton.itemStateChanged()");
    switch (this.bytGtype) {
        case DataJToggleButton.bytS_CLOSE_WINDOW:
            this.objGdataJFrame.windowClosing(null);
            this.removeItemListener(this);
            this.setSelected(false);
            this.addItemListener(this);
            break;
        case DataJToggleButton.bytS_CONTENT_ADJUSTMENT:
        case DataJToggleButton.bytS_WINDOW_ADJUSTMENT:
            final boolean bolLselected = objPitemEvent.getStateChange() == ItemEvent.SELECTED;
            this.objGdataJFrame.doToggleJButtons(this.bytGtype, bolLselected);
            if (bolLselected) {
                this.objGdataJFrame.doAdjustFields(this.bytGtype == DataJToggleButton.bytS_WINDOW_ADJUSTMENT);
            }
            this.setText();
            break;
    }

}
项目:MapAnalyst    文件:CheckBoxNodeEditor.java   
@Override
public Component getTreeCellEditorComponent(final JTree tree,
    final Object value, final boolean selected, final boolean expanded,
    final boolean leaf, final int row) {

    final Component editor =
        renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf,
            row, true);

    // editor always selected / focused
    final ItemListener itemListener = new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent itemEvent) {
            if (stopCellEditing()) {
                fireEditingStopped();
            }
        }
    };
    if (editor instanceof CheckBoxNodePanel) {
        final CheckBoxNodePanel panel = (CheckBoxNodePanel) editor;
        panel.check.addItemListener(itemListener);
    }

    return editor;
}
项目:incubator-netbeans    文件:UnboundTargetAlert.java   
/**
 * Just show the dialog but do not do anything about it.
 */
private boolean displayAlert(String projectDisplayName) {
    String title = NbBundle.getMessage(UnboundTargetAlert.class, "UTA_TITLE", label, projectDisplayName);
    final DialogDescriptor d = new DialogDescriptor(this, title);
    d.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    d.setMessageType(NotifyDescriptor.ERROR_MESSAGE);
    d.setValid(false);
    selectCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            d.setValid(((String) selectCombo.getSelectedItem()).trim().length() > 0);
        }
    });
    Dialog dlg = DialogDisplayer.getDefault().createDialog(d);
    selectCombo.requestFocusInWindow();
    // XXX combo box gets cut off at the bottom unless you do something - why??
    Dimension sz = dlg.getSize();
    dlg.setSize(sz.width, sz.height + 30);
    dlg.setVisible(true);
    return d.getValue() == NotifyDescriptor.OK_OPTION;
}
项目:sstore-soft    文件:ConnectionDialogSwing.java   
public void itemStateChanged(ItemEvent e) {

        String s = (String) e.getItem();

        for (int i = 0; i < connTypes.length; i++) {
            if (s.equals(connTypes[i][0])) {
                mDriver.setText(connTypes[i][1]);
                mURL.setText(connTypes[i][2]);
            }
        }
    }
项目:openjdk-jdk10    文件:WListPeer.java   
void handleListChanged(final int index) {
    final List l = (List)target;
    WToolkit.executeOnEventHandlerThread(l, new Runnable() {
        @Override
        public void run() {
            postEvent(new ItemEvent(l, ItemEvent.ITEM_STATE_CHANGED,
                            Integer.valueOf(index),
                            isSelected(index)? ItemEvent.SELECTED :
                                               ItemEvent.DESELECTED));

        }
    });
}
项目:Library-app    文件:NuevoPrestamo.java   
@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getItemSelectable().equals(tipo)) {
        if (!tipo.getSelectedItem().equals("Seleccione")) {
            lblCodigo.setText("Codigo "+tipo.getSelectedItem());
            btnBuscarCodigo.setEnabled(true);
        } else {
            btnBuscarCodigo.setEnabled(false);
            lblCodigo.setText("Codigo ");
        }
        return;
    }
}
项目:s-store    文件:Transfer.java   
/**
 * Method declaration
 *
 *
 * @param e
 */
public void itemStateChanged(ItemEvent e) {

    ItemSelectable item = e.getItemSelectable();

    if (item == lTable) {
        if (iSelectionStep == SELECT_SOURCE_TABLES) {
            String table    = lTable.getSelectedItem();
            int    selected = ((Integer) e.getItem()).intValue();

            for (int i = 0; i < tTable.size(); i++) {
                TransferTable t = (TransferTable) tTable.elementAt(i);

                if (t == null) {
                    continue;
                }

                if (i == selected) {
                    saveTable();
                    displayTable(t);
                    updateEnabled(true);
                }
            }
        }
    } else {

        // it must be a checkbox
        saveTable();
        updateEnabled(true);
    }
}
项目:sstore-soft    文件:SchemaVisualization.java   
public void itemStateChanged(ItemEvent e) {
   JMenuItem source = (JMenuItem)(e.getSource());
   String s = "Item event detected.\n"
              + "    Event source: " + source.getText()
              + " (an instance of " + source.getClass().getName() + ")\n"
              + "    New state: "
              + ((e.getStateChange() == ItemEvent.SELECTED) ?
                "selected":"unselected") + "\n\n";
   System.err.println(s);
}
项目:OpenDiabetes    文件:Transfer.java   
/**
 * Method declaration
 *
 *
 * @param e
 */
public void itemStateChanged(ItemEvent e) {

    ItemSelectable item = e.getItemSelectable();

    if (item == lTable) {
        if (iSelectionStep == SELECT_SOURCE_TABLES) {
            String table    = lTable.getSelectedItem();
            int    selected = ((Integer) e.getItem()).intValue();

            for (int i = 0; i < tTable.size(); i++) {
                TransferTable t = (TransferTable) tTable.elementAt(i);

                if (t == null) {
                    continue;
                }

                if (i == selected) {
                    saveTable();
                    displayTable(t);
                    updateEnabled(true);
                }
            }
        }
    } else {

        // it must be a checkbox
        saveTable();
        updateEnabled(true);
    }
}
项目:JuggleMasterPro    文件:FXJCheckBox.java   
/**
 * Method description
 * 
 * @see
 * @param objPitemEvent
 */
@Override final public void itemStateChanged(ItemEvent objPitemEvent) {
    // this.setToolTipText(objPitemEvent.getStateChange() == ItemEvent.SELECTED);
    Tools.debug("FXJCheckBox.itemStateChanged()");
    this.validate();
    FXActions.doDisplayFX(this.objGcontrolJFrame, objPitemEvent.getStateChange() == ItemEvent.SELECTED);
}
项目:incubator-netbeans    文件:CheckBoxWithButtonPanel.java   
@Override
public void itemStateChanged(ItemEvent e) {
    if (checkbox.isSelected()) {
        buttonPanel.enableButton();
    } else {
        buttonPanel.disableButton();
    }
    this.setMinimumSize(this.getPreferredSize()); // #214745
}
项目:dev-courses    文件:ConnectionDialog.java   
public void itemStateChanged(ItemEvent e) {

        String s = (String) e.getItem();

        for (int i = 0; i < connTypes.length; i++) {
            if (s.equals(connTypes[i][0])) {
                mDriver.setText(connTypes[i][1]);
                mURL.setText(connTypes[i][2]);
            }
        }
    }
项目:FreeCol    文件:AbstractUnitOptionUI.java   
/**
 * {@inheritDoc}
 */
@Override
public void itemStateChanged(ItemEvent e) {
    // When the unit type changes, we have to reset the role choices
    JComboBox<String> box = this.roleUI.getComponent();
    DefaultComboBoxModel<String> model;
    boolean enable = false;
    UnitType type = (UnitType)this.typeUI.getComponent().getSelectedItem();
    if (type != null && type.hasAbility(Ability.CAN_BE_EQUIPPED)) {
        final Specification spec = type.getSpecification();
        final NationType nt = getOption().getNationType();
        int n = 0;
        model = new DefaultComboBoxModel<>();
        for (String ri : getOption().getRole().getChoices()) {
            Role role = spec.getRole(ri);
            if (role.isAvailableTo(type, nt)) {
                model.addElement(ri);
                n++;
            }
        }
        enable = isEditable() && n > 1;
    } else {
        model = new DefaultComboBoxModel<>(new String[] {
                Specification.DEFAULT_ROLE_ID });
    }
    box.setModel(model);
    box.setEnabled(enable);
}
项目:Equella    文件:ComboBoxChoiceList.java   
@SuppressWarnings("nls")
public ComboBoxChoiceList(String labelText)
{
    comboBox = new JComboBox<>();
    comboBox.addItemListener(new ItemListener()
    {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
            NameValue nv = (NameValue) e.getItem();
            if( nv != null )
            {
                if( e.getStateChange() == ItemEvent.SELECTED )
                {
                    choiceSelected(nv);
                }
                else if( e.getStateChange() == ItemEvent.DESELECTED )
                {
                    choiceDeselected(nv);
                }
            }
        }
    });

    choiceSink = new JPanel(new GridLayout(1, 1));

    setLayout(new MigLayout("insets 0, hidemode 3", "[][grow]"));
    if( labelText != null )
    {
        add(new JLabel(labelText));
    }
    add(comboBox, "cell 1 0");
    add(choiceSink, "cell 0 1, span");

    changeDetector.watch(comboBox);
}
项目:VASSAL-src    文件:CheckBoxMenuItemProxy.java   
public void itemStateChanged(ItemEvent e) {
  state = e.getStateChange() == ItemEvent.SELECTED;

  forEachPeer(new Functor<JCheckBoxMenuItem>() {
    public void apply(JCheckBoxMenuItem item) {
      item.setSelected(state);
    }
  });
}
项目:MailCopier    文件:SettingsForm.java   
private JComboBox<String> get_appearance_combo() {
    if(appearance_combo == null) {
        ItemListener il = new ItemListener() {
                public void itemStateChanged(ItemEvent event) {
                    main.updateFrames();
                }
            };
        appearance_combo = tManager.createThemesComboBox(il);
    }
    return appearance_combo;
}
项目:incubator-netbeans    文件:JavaTestCreatorConfiguration.java   
@Override
public void itemStateChanged(ItemEvent e) {
    final Object source = e.getSource();

    assert source == chkPublic
           || source == chkProtected
           || source == chkPackage;
    callback.checkAcceptability();
}
项目:parabuild-ci    文件:ConnectionDialog.java   
public void itemStateChanged(ItemEvent e) {

        String s = (String) e.getItem();

        for (int i = 0; i < connTypes.length; i++) {
            if (s.equals(connTypes[i][0])) {
                mDriver.setText(connTypes[i][1]);
                mURL.setText(connTypes[i][2]);
            }
        }
    }
项目:sstore-soft    文件:ZaurusTableForm.java   
public void itemStateChanged(ItemEvent e) {

        for (int i = 0; i < columns.length; i++) {
            if (komponente[i] == e.getSource()) {
                komponente[i].setChanged();

                break;
            }
        }
    }
项目:intellij-idea-plugin-connector-for-aws-lambda    文件:ConnectorViewFactory.java   
private void runSetFunction(ConnectorPresenter presenter, ItemEvent e) {
    if(operationInProgress || setRegionOperationInProgress
            || e.getStateChange() != ItemEvent.SELECTED)
        return;
    FunctionEntry entry = (FunctionEntry)e.getItem();
    if(entry == null)
        return;
    runOperation(() -> presenter.setFunction(entry), "Select function: " + entry.toString());
}
项目:FreeCol    文件:BuildQueuePanel.java   
/**
 * Override {@link ItemListener} for this panel's use.
 *      This function evaluates whether a the user has
 *      clicked the {@link #compactBox} or the
 *      {@link #showAllBox} has been checked.
 *
 * {@inheritDoc}
 */
@Override
public void itemStateChanged(ItemEvent event) {
    if (event.getSource() == this.compactBox) {
        updateDetailView();
        updateCompact(this.compactBox.isSelected());
    } else if (event.getSource() == this.showAllBox) {
        updateAllLists();
        updateLists(this.showAllBox.isSelected());
    }
}
项目:parabuild-ci    文件:ConnectionDialogSwing.java   
public void itemStateChanged(ItemEvent e) {

        String s = (String) e.getItem();

        for (int i = 0; i < connTypes.length; i++) {
            if (s.equals(connTypes[i][0])) {
                mDriver.setText(connTypes[i][1]);
                mURL.setText(connTypes[i][2]);
            }
        }
    }
项目:intellij-idea-plugin-connector-for-aws-lambda    文件:ConnectorViewFactory.java   
private void runSetTestFunctionInputFromRecent(ConnectorPresenter presenter, ItemEvent e) {
    if(operationInProgress
            || e.getStateChange() != ItemEvent.SELECTED)
        return;
    TestFunctionInputEntry entry = (TestFunctionInputEntry)e.getItem();
    if(entry == null)
        return;
    runOperation(() -> presenter.setSetTestFunctionInputFromRecent(entry), "Select test function input from file: ", entry.getFileName());
}
项目:incubator-netbeans    文件:OutputPanel.java   
private void sourceFolderItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_sourceFolderItemStateChanged
    if (ignoreEvent) {
        return;
    }
    if (evt.getStateChange() == ItemEvent.DESELECTED) {
        int index = findIndex(evt.getItem());
        // if index == -1 then item was removed and will not be saved
        if (index != -1) {
            saveOutput(index);
        }
    } else {
        loadOutput();
    }
}
项目:JuggleMasterPro    文件:LightJCheckBox.java   
/**
 * Method description
 * 
 * @see
 * @param objPitemEvent
 */
@Override final public void itemStateChanged(ItemEvent objPitemEvent) {

    Tools.debug("LightJCheckBox.itemStateChanged()");
    this.validate();
    FXActions.doSwitchLight(this.objGcontrolJFrame, objPitemEvent.getStateChange() == ItemEvent.SELECTED);
}
项目:incubator-netbeans    文件:PropertiesPanel.java   
/** Called when the Recursive check-box is toggled. */
@Override
public void itemStateChanged(ItemEvent e) {
    assert e.getSource() == cbxRecursively;
    updateIsRecursive();
    recursiveToggled();
}
项目:parabuild-ci    文件:Transfer.java   
/**
 * Method declaration
 *
 *
 * @param e
 */
public void itemStateChanged(ItemEvent e) {

    ItemSelectable item = e.getItemSelectable();

    if (item == lTable) {
        if (iSelectionStep == SELECT_SOURCE_TABLES) {
            String table    = lTable.getSelectedItem();
            int    selected = ((Integer) e.getItem()).intValue();

            for (int i = 0; i < tTable.size(); i++) {
                TransferTable t = (TransferTable) tTable.elementAt(i);

                if (t == null) {
                    continue;
                }

                if (i == selected) {
                    saveTable();
                    displayTable(t);
                    updateEnabled(true);
                }
            }
        }
    } else {

        // it must be a checkbox
        saveTable();
        updateEnabled(true);
    }
}
项目:OpenJSharp    文件:DrawTest.java   
@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getSource() instanceof Checkbox) {
        target.setForeground(((Component) e.getSource()).getForeground());
    } else if (e.getSource() instanceof Choice) {
        String choice = (String) e.getItem();
        if (choice.equals("Lines")) {
            target.setDrawMode(DrawPanel.LINES);
        } else if (choice.equals("Points")) {
            target.setDrawMode(DrawPanel.POINTS);
        }
    }
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ObjectRepo.java   
@Override
public void itemStateChanged(ItemEvent ie) {
    if (ie.getStateChange() == ItemEvent.SELECTED) {
        CardLayout layout = (CardLayout) repos.getLayout();
        layout.show(repos, ((JToggleButton) ie.getSource()).getActionCommand());
    }
}