Java Code Examples for java.awt.event.ItemEvent

The following are top voted examples for showing how to use java.awt.event.ItemEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: LivroJavaComoProgramar10Edicao   File: ComboBoxFrame.java   View source code 6 votes vote down vote up
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
}
 
Example 2
Project: PTEAssistant   File: UserSettingFrame.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 3
Project: Laserscan-to-dxf   File: CheckBoxWithText.java   View source code 6 votes vote down vote up
/**
 * 
 */
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);
			}
		}
		
	});
}
 
Example 4
Project: VASSAL-src   File: ReportState.java   View source code 6 votes vote down vote up
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);
    }
 
Example 5
Project: incubator-netbeans   File: InternationalizationResourceBundleBrandingPanel.java   View source code 6 votes vote down vote up
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);
                            }
                        }
                    });
                }
            });
        }
    });
}
 
Example 6
Project: FreeCol   File: ConfirmDeclarationDialog.java   View source code 6 votes vote down vote up
/**
 * {@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()));
}
 
Example 7
Project: cuttlefish   File: ViewMenu.java   View source code 6 votes vote down vote up
@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");
	}
}
 
Example 8
Project: processing-idea   File: ProcessingSketchRootSelectStep.java   View source code 6 votes vote down vote up
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());
            }
        }
    }
}
 
Example 9
Project: AgentWorkbench   File: JadeSetupMTP.java   View source code 6 votes vote down vote up
@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);
		}
	}
}
 
Example 10
Project: ramus   File: TableViewPreferenciesDialog.java   View source code 6 votes vote down vote up
@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;
    }
}
 
Example 11
Project: openjdk-jdk10   File: Font2DTest.java   View source code 6 votes vote down vote up
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();
        }
    }
}
 
Example 12
Project: JuggleMasterPro   File: DataJToggleButton.java   View source code 6 votes vote down vote up
@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;
	}

}
 
Example 13
Project: MapAnalyst   File: CheckBoxNodeEditor.java   View source code 6 votes vote down vote up
@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;
}
 
Example 14
Project: incubator-netbeans   File: UnboundTargetAlert.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: sstore-soft   File: ConnectionDialogSwing.java   View source code 5 votes vote down vote up
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]);
            }
        }
    }
 
Example 16
Project: openjdk-jdk10   File: WListPeer.java   View source code 5 votes vote down vote up
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));

        }
    });
}
 
Example 17
Project: Library-app   File: NuevoPrestamo.java   View source code 5 votes vote down vote up
@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;
	}
}
 
Example 18
Project: s-store   File: Transfer.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 19
Project: sstore-soft   File: SchemaVisualization.java   View source code 5 votes vote down vote up
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);
}
 
Example 20
Project: OpenDiabetes   File: Transfer.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 21
Project: JuggleMasterPro   File: FXJCheckBox.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 22
Project: incubator-netbeans   File: CheckBoxWithButtonPanel.java   View source code 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
    if (checkbox.isSelected()) {
        buttonPanel.enableButton();
    } else {
        buttonPanel.disableButton();
    }
    this.setMinimumSize(this.getPreferredSize()); // #214745
}
 
Example 23
Project: dev-courses   File: ConnectionDialog.java   View source code 5 votes vote down vote up
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]);
            }
        }
    }
 
Example 24
Project: FreeCol   File: AbstractUnitOptionUI.java   View source code 5 votes vote down vote up
/**
 * {@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);
}
 
Example 25
Project: Equella   File: ComboBoxChoiceList.java   View source code 5 votes vote down vote up
@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);
}
 
Example 26
Project: VASSAL-src   File: CheckBoxMenuItemProxy.java   View source code 5 votes vote down vote up
public void itemStateChanged(ItemEvent e) {
  state = e.getStateChange() == ItemEvent.SELECTED;

  forEachPeer(new Functor<JCheckBoxMenuItem>() {
    public void apply(JCheckBoxMenuItem item) {
      item.setSelected(state);
    }
  });
}
 
Example 27
Project: MailCopier   File: SettingsForm.java   View source code 5 votes vote down vote up
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;
}
 
Example 28
Project: incubator-netbeans   File: JavaTestCreatorConfiguration.java   View source code 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
    final Object source = e.getSource();
    
    assert source == chkPublic
           || source == chkProtected
           || source == chkPackage;
    callback.checkAcceptability();
}
 
Example 29
Project: parabuild-ci   File: ConnectionDialog.java   View source code 5 votes vote down vote up
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]);
            }
        }
    }
 
Example 30
Project: sstore-soft   File: ZaurusTableForm.java   View source code 5 votes vote down vote up
public void itemStateChanged(ItemEvent e) {

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

                break;
            }
        }
    }
 
Example 31
Project: intellij-idea-plugin-connector-for-aws-lambda   File: ConnectorViewFactory.java   View source code 5 votes vote down vote up
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());
}
 
Example 32
Project: FreeCol   File: BuildQueuePanel.java   View source code 5 votes vote down vote up
/**
 * 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());
    }
}
 
Example 33
Project: parabuild-ci   File: ConnectionDialogSwing.java   View source code 5 votes vote down vote up
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]);
            }
        }
    }
 
Example 34
Project: intellij-idea-plugin-connector-for-aws-lambda   File: ConnectorViewFactory.java   View source code 5 votes vote down vote up
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());
}
 
Example 35
Project: incubator-netbeans   File: OutputPanel.java   View source code 5 votes vote down vote up
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();
    }
}
 
Example 36
Project: JuggleMasterPro   File: LightJCheckBox.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 37
Project: incubator-netbeans   File: PropertiesPanel.java   View source code 5 votes vote down vote up
/** Called when the Recursive check-box is toggled. */
@Override
public void itemStateChanged(ItemEvent e) {
    assert e.getSource() == cbxRecursively;
    updateIsRecursive();
    recursiveToggled();
}
 
Example 38
Project: parabuild-ci   File: Transfer.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 39
Project: Cognizant-Intelligent-Test-Scripter   File: ObjectRepo.java   View source code 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent ie) {
    if (ie.getStateChange() == ItemEvent.SELECTED) {
        CardLayout layout = (CardLayout) repos.getLayout();
        layout.show(repos, ((JToggleButton) ie.getSource()).getActionCommand());
    }
}
 
Example 40
Project: etomica   File: MyApplet.java   View source code 5 votes vote down vote up
public void itemStateChanged(ItemEvent evt) {
    boolean enabled = onlyDoublyConnectedCB.getState();
    reeHooverCB.setEnabled(enabled);
    enabled = enabled && reeHooverCB.getState();
    eDrawBondsCB.setEnabled(enabled);
    fDrawBondsCB.setEnabled(enabled);
}