Java Code Examples for java.awt.event.ItemEvent#SELECTED
The following examples show how to use
java.awt.event.ItemEvent#SELECTED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckboxMenuItemGroup.java From proxyee-down with Apache License 2.0 | 6 votes |
@Override public void itemStateChanged(ItemEvent e) { CheckboxMenuItem checkedItem = ((CheckboxMenuItem) e.getSource()); if (e.getStateChange() == ItemEvent.SELECTED) { String selectedItemName = checkedItem.getName(); for (CheckboxMenuItem item : items) { if (!item.getName().equals(selectedItemName)) { item.setState(false); } } if (itemListener != null) { itemListener.itemStateChanged(e); } } else { checkedItem.setState(true); } }
Example 2
Source File: JExtendedComboBox.java From netbeans with Apache License 2.0 | 6 votes |
protected void fireItemStateChanged(ItemEvent e) { switch (e.getStateChange()) { case ItemEvent.SELECTED: if (e.getItem() instanceof JSeparator) { SwingUtilities.invokeLater(new Runnable() { public void run() { selectNextItem(); } }); } break; case ItemEvent.DESELECTED: if (!(e.getItem() instanceof JSeparator)) { lastSelectedIndex = model.getIndexOf(e.getItem()); } break; } super.fireItemStateChanged(e); }
Example 3
Source File: PortJobTab.java From datasync with MIT License | 5 votes |
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { PortMethod item = (PortMethod) e.getItem(); switch (item) { case copy_data: sinkSetIDTextField.setText(""); sinkSetIDTextField.setEditable(true); jobPanel.remove(publishDatasetContainerLeft); jobPanel.remove(publishDatasetContainerRight); publishDatasetComboBox.setEnabled(false); jobPanel.add(publishMethodContainerLeft); jobPanel.add(publishMethodContainerRight); publishMethodComboBox.setEnabled(true); jobPanel.updateUI(); break; case copy_schema: case copy_all: sinkSetIDTextField.setText(DEFAULT_DESTINATION_SET_ID); sinkSetIDTextField.setEditable(false); jobPanel.remove(publishMethodContainerLeft); jobPanel.remove(publishMethodContainerRight); publishMethodComboBox.setEnabled(false); jobPanel.add(publishDatasetContainerLeft); jobPanel.add(publishDatasetContainerRight); publishDatasetComboBox.setEnabled(true); jobPanel.updateUI(); break; } } }
Example 4
Source File: TransferSelector.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { model.selectAll(); treeView.repaintTree(); } else if (e.getStateChange() == ItemEvent.DESELECTED) { model.unselectAll(); treeView.repaintTree(); } }
Example 5
Source File: CCheckboxMenuItem.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void handleAction(final boolean state) { final CheckboxMenuItem target = (CheckboxMenuItem)getTarget(); SunToolkit.executeOnEventHandlerThread(target, new Runnable() { public void run() { target.setState(state); } }); ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED); SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event); }
Example 6
Source File: CheckBoxUpdater.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (ItemEvent.SELECTED == e.getStateChange() || ItemEvent.DESELECTED == e.getStateChange()) { boolean isSelected = checkBox.isSelected(); if (verifier != null) { if (verifier.verifyValue(isSelected)) { setValue(isSelected); } } else { // If there is no defined verifier, simply change the value setValue(isSelected); } } }
Example 7
Source File: FunctionEditorTopComponent.java From opensim-gui with Apache License 2.0 | 5 votes |
private void crosshairsCheckBoxStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_crosshairsCheckBoxStateChanged if (function != null && functionPanel != null) { if (evt.getStateChange() == ItemEvent.SELECTED) functionPanel.setMandatoryCrosshairs(true); else functionPanel.setMandatoryCrosshairs(false); } }
Example 8
Source File: BasicCompanionView.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void itemStateChanged (ItemEvent evt) { // The need checkbox has changed if (evt.getStateChange() == ItemEvent.SELECTED) { companion.setNeed(Need.SELECTED); } else { companion.setNeed(Need.NOT_SELECTED); } update(); }
Example 9
Source File: QuickSearchPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (repositoryComboBox.isEnabled()) { enableFields(); } if(e.getStateChange() == ItemEvent.SELECTED) { Object item = e.getItem(); if(item instanceof Repository) { Repository repo = (Repository) item; qs.setRepository(repo); } } }
Example 10
Source File: ExcelSheetSelectionPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (!updatingUI) { int newSheetIndex = sheetComboBox.getSelectedIndex(); sheetSelectionModel.setSheetIndex(newSheetIndex); } } }
Example 11
Source File: GeochronSampleCustomMetadataDialog.java From ET_Redux with Apache License 2.0 | 5 votes |
public void itemStateChanged ( ItemEvent evt ) { if ( evt.getStateChange() == ItemEvent.SELECTED ) { // Item was just selected sample.setAnalysisPurpose( ANALYSIS_PURPOSE.valueOf( (String) evt.getItem() ) ); // show detrital choices detritalTypePanel.setVisible( sample.getAnalysisPurpose().compareTo( ANALYSIS_PURPOSE.DetritalSpectrum ) == 0 ); } else if ( evt.getStateChange() == ItemEvent.DESELECTED ) { // Item is no longer selected } }
Example 12
Source File: ImageSpy.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
private void addNewPageItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_addNewPageItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { showPanel(); showAddPageView(); } else { hidePanel(); } cropCtrl.refresh(); }
Example 13
Source File: ImageSpy.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
private void addAsObjectItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_addAsObjectItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { showPanel(); showAddObjectView(); } else { hidePanel(); } cropCtrl.refresh(); }
Example 14
Source File: ServiceDialog.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int index = cbName.getSelectedIndex(); if ((index >= 0) && (index < services.length)) { if (!services[index].equals(psCurrent)) { psCurrent = services[index]; uiFactory = psCurrent.getServiceUIFactory(); changedService = true; Destination dest = (Destination)asOriginal.get(Destination.class); // to preserve the state of Print To File if ((dest != null || isPrintToFileSelected()) && psCurrent.isAttributeCategorySupported( Destination.class)) { if (dest != null) { asCurrent.add(dest); } else { dest = (Destination)psCurrent. getDefaultAttributeValue(Destination.class); // "dest" should not be null. The following code // is only added to safeguard against a possible // buggy implementation of a PrintService having a // null default Destination. if (dest == null) { try { dest = new Destination(new URI("file:out.prn")); } catch (URISyntaxException ue) { } } if (dest != null) { asCurrent.add(dest); } } } else { asCurrent.remove(Destination.class); } } } } }
Example 15
Source File: IntroduceLocalExtensionPanel.java From netbeans with Apache License 2.0 | 4 votes |
private void chkReplaceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkReplaceItemStateChanged Boolean b = evt.getStateChange() == ItemEvent.SELECTED ? Boolean.TRUE : Boolean.FALSE; RefactoringModule.setOption(REPLACEALL, b); parent.stateChanged(null); }
Example 16
Source File: ChangeParametersPanel.java From netbeans with Apache License 2.0 | 4 votes |
private void chkUpdateJavadocItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkUpdateJavadocItemStateChanged Boolean b = evt.getStateChange() == ItemEvent.SELECTED ? Boolean.TRUE : Boolean.FALSE; RefactoringModule.setOption(UPDATEJAVADOC, b); // NOI18N updatePreview(); }
Example 17
Source File: LazyComboBox.java From visualvm with GNU General Public License v2.0 | 4 votes |
protected void fireItemStateChanged(ItemEvent e) { super.fireItemStateChanged(e); if (e.getStateChange() == ItemEvent.SELECTED) selectionChanged(); }
Example 18
Source File: RepositorySelectorBuilder.java From netbeans with Apache License 2.0 | 4 votes |
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { itemSelected(e.getItem()); } }
Example 19
Source File: Options.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
private void reportComboItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_reportComboItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { settheme(evt.getItem().toString()); saved = false; } }
Example 20
Source File: ServiceDialog.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int index = cbName.getSelectedIndex(); if ((index >= 0) && (index < services.length)) { if (!services[index].equals(psCurrent)) { psCurrent = services[index]; uiFactory = psCurrent.getServiceUIFactory(); changedService = true; Destination dest = (Destination)asOriginal.get(Destination.class); // to preserve the state of Print To File if ((dest != null || isPrintToFileSelected()) && psCurrent.isAttributeCategorySupported( Destination.class)) { if (dest != null) { asCurrent.add(dest); } else { dest = (Destination)psCurrent. getDefaultAttributeValue(Destination.class); // "dest" should not be null. The following code // is only added to safeguard against a possible // buggy implementation of a PrintService having a // null default Destination. if (dest == null) { try { dest = new Destination(new URI("file:out.prn")); } catch (URISyntaxException ue) { } } if (dest != null) { asCurrent.add(dest); } } } else { asCurrent.remove(Destination.class); } } } } }