Java Code Examples for java.awt.event.ItemEvent#getItem()
The following examples show how to use
java.awt.event.ItemEvent#getItem() .
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: VideoCaptureComponent.java From COMP3204 with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void itemStateChanged(ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { final String item = (String) event.getItem(); final Device d = VideoCapture.getVideoDevices().get(sources.getSelectedIndex()); if (d.getNameStr().equals(item) && !currentDevice.equals(d)) { try { currentDevice = d; display.setMode(Mode.STOP); display.getVideo().close(); display.changeVideo(new VideoCapture(width, height, currentDevice)); display.setMode(Mode.PLAY); } catch (final VideoCaptureException e) { e.printStackTrace(); } } } }
Example 2
Source File: GeochronSampleCustomMetadataDialog.java From ET_Redux with Apache License 2.0 | 6 votes |
public void itemStateChanged ( ItemEvent evt ) { String geologicAge = (String) evt.getItem(); if ( evt.getStateChange() == ItemEvent.SELECTED ) { // parse the string to get ages String[] pass1 = geologicAge.split( "\\x28" );//?"(" String[] pass2 = pass1[1].split( "-" ); String ageMin = pass2[0].split( "Ma" )[0].trim(); String ageMax = pass2[1].split( "Ma" )[0].trim(); System.out.println( "AGE = " + ageMin + " " + ageMax ); minAbsAgeMa_txtBox.setText( ageMin ); maxAbsAgeMa_txtBox.setText( ageMax ); } else if ( evt.getStateChange() == ItemEvent.DESELECTED ) { // Item is no longer selected } }
Example 3
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 4
Source File: JExtendedComboBox.java From visualvm with GNU General Public License v2.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 5
Source File: DrawTest.java From hottub with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 6
Source File: ConnectionDialog.java From nextreports-designer with Apache License 2.0 | 5 votes |
public void itemStateChanged(ItemEvent e) { String s = (String) e.getItem(); for (DriverTemplate template : templates) { if (s.equals(template.getType())) { mDriver.setText(template.getClassName()); mURL.setText(template.getUrlTemplate()); urlFormatLabel.setText(template.getUrlTemplate()); defaultPort = template.getDefaultPort(); } } }
Example 7
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 8
Source File: AliasInternalFrame.java From bigtable-sql with Apache License 2.0 | 5 votes |
public void itemStateChanged(ItemEvent evt) { ISQLDriver driver = (ISQLDriver) evt.getItem(); if (driver != null) { _url.setText(driver.getUrl()); } }
Example 9
Source File: ConnectionDialogSwing.java From evosql with Apache License 2.0 | 5 votes |
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 10
Source File: DrawTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 11
Source File: DrawTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 12
Source File: DrawTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 13
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 14
Source File: DrawTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@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); } } }
Example 15
Source File: ButtonItemListener.java From Astrosoft with GNU General Public License v2.0 | 5 votes |
public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == 1) { JToggleButton button = (JToggleButton)e.getItem(); calendar.setDay(button.getText()); Integer temp = (Integer)calendar.yearCombo.getSelectedItem(); calendar.setYear(temp.toString()); temp = new Integer(calendar.monthCombo.getSelectedIndex() + 1); calendar.setMonth(temp.toString()); setChanged(); notifyObservers(); } }
Example 16
Source File: PanelTableHeaderRenderer.java From chipster with MIT License | 5 votes |
public void itemStateChanged(ItemEvent e) { if(e.getSource() instanceof JComboBox){ Integer newValue = (Integer)e.getItem(); // Change the chip number only if it has really changed. if(newValue != screen.getColumnTypeManager().getColumnChipNumber(columnIndex)){ screen.getColumnTypeManager().setColumnChipNumber(columnIndex, newValue); } } }
Example 17
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 18
Source File: FilterDialog.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void itemStateChanged(ItemEvent e) { if (ignoreCallbacks) { return; } JCheckBox cb = (JCheckBox) e.getItem(); String name = cb.getText(); setChanged(true); filter.setFilter(name, cb.isSelected()); update(); }
Example 19
Source File: JLocaleChooser.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * The ItemListener for the locales. */ public void itemStateChanged(ItemEvent iEvt) { String item = (String) iEvt.getItem(); int i; for (i = 0; i < localeCount; i++) { if (locales[i].getDisplayName().equals(item)) break; } setLocale(locales[i], false); }
Example 20
Source File: UIManagerDefaults.java From darklaf with MIT License | 4 votes |
public void itemStateChanged(final ItemEvent e) { final String itemName = (String) e.getItem(); changeTableModel(itemName); updateRowHeights(); selectedItem = itemName; }