List of usage examples for java.awt.event ItemEvent getSource
public Object getSource()
From source file:ExSwitch.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); // Check if it is switch choice for (int i = 0; i < switchMenu.length; i++) { if (src == switchMenu[i]) { // Update the checkboxes switchMenu[currentSwitch].setState(false); currentSwitch = i;//from w w w. j av a 2 s . c o m switchMenu[currentSwitch].setState(true); // Set the switch swtch.setWhichChild(options[currentSwitch].child); swtch.setChildMask(options[currentSwitch].mask); return; } } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:ExHenge.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); if (src == ambientOnOffMenu) { ambientOnOff = ambientOnOffMenu.getState(); ambient.setEnable(ambientOnOff); return;//from w w w . j av a 2s . c o m } if (src == brightAmbientOnOffMenu) { brightAmbientOnOff = brightAmbientOnOffMenu.getState(); brightAmbient.setEnable(brightAmbientOnOff); return; } if (src == redDirectionalOnOffMenu) { redDirectionalOnOff = redDirectionalOnOffMenu.getState(); redDirectional.setEnable(redDirectionalOnOff); return; } if (src == yellowDirectionalOnOffMenu) { yellowDirectionalOnOff = yellowDirectionalOnOffMenu.getState(); yellowDirectional.setEnable(yellowDirectionalOnOff); return; } if (src == orangePointOnOffMenu) { orangePointOnOff = orangePointOnOffMenu.getState(); orangePoint.setEnable(orangePointOnOff); return; } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:ExLinearFog.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); // Check if it is the coupled background choice if (src == coupledBackgroundOnOffMenu) { coupledBackgroundOnOff = coupledBackgroundOnOffMenu.getState(); if (coupledBackgroundOnOff) { currentBackgroundColor = currentColor; backgroundColorMenu.setCurrent(currentColor); Color3f color = (Color3f) colors[currentColor].value; background.setColor(color);/*www . j ava2 s .co m*/ backgroundColorMenu.setEnabled(false); } else { backgroundColorMenu.setEnabled(true); } } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:ExSound.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); if (src == backgroundSoundOnOffMenu) { // Turn the background sound on or off backgroundSoundOnOff = backgroundSoundOnOffMenu.getState(); backgroundSound.setEnable(backgroundSoundOnOff); ambientLight.setEnable(backgroundSoundOnOff); return;/* w ww .j av a 2s.c o m*/ } if (src == pointSoundOnOffMenu) { // Turn the point sound on or off pointSoundOnOff = pointSoundOnOffMenu.getState(); pointSound.setEnable(pointSoundOnOff); pointLight.setEnable(pointSoundOnOff); return; } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:ExClip.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); // Check if it is the coupled background choice if (src == coupledBackgroundOnOffMenu) { coupledBackgroundOnOff = coupledBackgroundOnOffMenu.getState(); if (coupledBackgroundOnOff) { currentBackgroundColor = currentColor; backgroundColorMenu.setCurrent(currentColor); Color3f color = (Color3f) colors[currentColor].value; background.setColor(color);//from w ww. j av a2 s.co m backgroundColorMenu.setEnabled(false); } else { backgroundColorMenu.setEnabled(true); } } // Check if it is the coupled clip back distance choice if (src == coupledClipBackOnOffMenu) { coupledClipBackOnOff = coupledClipBackOnOffMenu.getState(); if (coupledClipBackOnOff) { currentClipBack = currentBack; clipBackMenu.setCurrent(currentClipBack); float clipBack = ((Float) clipBacks[currentClipBack].value).floatValue(); clip.setBackDistance(clipBack); clipBackMenu.setEnabled(false); } else { clipBackMenu.setEnabled(true); } } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:ExBluePrint.java
public void itemStateChanged(ItemEvent event) { Object src = event.getSource(); // Check if it is an image choice for (int i = 0; i < imageMenu.length; i++) { if (src == imageMenu[i]) { // Update the checkboxes imageMenu[currentImage].setState(false); currentImage = i;/* www . j a v a 2 s . c o m*/ imageMenu[currentImage].setState(true); // Set the background image ImageComponent2D image = imageComponents[currentImage]; background.setImage(image); return; } } // Check if it is an appearance choice if (src == appearanceMenu[0]) { appearanceMenu[1].setState(false); shadingSwitch.setWhichChild(0); return; } if (src == appearanceMenu[1]) { appearanceMenu[0].setState(false); shadingSwitch.setWhichChild(1); return; } // Handle all other checkboxes super.itemStateChanged(event); }
From source file:gdsc.smlm.ij.plugins.CreateData.java
public void itemStateChanged(ItemEvent e) { // When the checkbox is clicked, output example compounds to the ImageJ log Checkbox cb = (Checkbox) e.getSource(); if (cb.getState()) { cb.setState(false);//from ww w . ja v a 2 s. c om logExampleCompounds(); } }
From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java
public FiltersPanel() { initComponents();/*from ww w . ja v a2 s . co m*/ filterTypeResolver = createFilterTypeResolver(); filterFormResolver = createFilterFormResolver(); ManufactorModelAdapter manufactorModelAdapter = new ManufactorModelAdapter(); List<Manufactor> theManufactors = carsService.getAllManufactors(); for (Manufactor manufactor : theManufactors) { manufactorModelAdapter.addManufactor(manufactor); } manufactors = new SelectionInList<ManufactorModel>(manufactorModelAdapter.getList()); series = new SelectionInList<SeriaModel>(); cbManufactors.setModel(new ComboBoxAdapter<ManufactorModel>(manufactors)); cbManufactors.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ManufactorModel manufactorModel = (ManufactorModel) e.getItem(); reReadSeries(manufactorModel.getManufactorIds()); } } }); cbSeria.setModel(new ComboBoxAdapter<SeriaModel>(series)); tblAllMotors.setModel(new BigMotorTableAdapter(allMotors)); tblAllMotors.setRowSorter(new BigMotorTableSorter((BigMotorTableAdapter) tblAllMotors.getModel())); tblAllMotors.setRowHeight(20); tblAllMotors.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { adjustButtonsEnabled(); } }); tblMotors.setModel(new BigMotorTableAdapter(motors)); tblMotors.setRowSorter(new BigMotorTableSorter((BigMotorTableAdapter) tblMotors.getModel())); tblMotors.setRowHeight(20); tblMotors.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { adjustButtonsEnabled(); } }); final BigFilterTableAdapter tblFiltersAdapter = new BigFilterTableAdapter(filters, filterTypeResolver, filterFormResolver); tblFiltersAdapter.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (e.getType() == TableModelEvent.UPDATE) { BigFilterTableAdapter adapter = (BigFilterTableAdapter) e.getSource(); int row = e.getFirstRow(); Filter filter = adapter.getRow(row); filtersService.updateFilter(filter); } } }); tblFilters.setUpdateSelectionOnSort(true); tblFilters.setModel(tblFiltersAdapter); tblFilters.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } adjustButtonsEnabled(); Long filterId = getSelectedFilterId(); reReadMotors(filterId); reReadOes(filterId); } }); tblFilters.setRowHeight(20); tblAllOes.setModel(new OeModelTableModel(allOes)); tblAllOes.setRowHeight(20); tblAllOes.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { adjustButtonsEnabled(); } }); tblOes.setModel(new OeModelTableModel(oes)); tblOes.setRowHeight(20); tblOes.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { adjustButtonsEnabled(); } }); // ?? ? ? if (System.getProperty("catalog.mode.fromMann") != null && System.getProperty("catalog.mode.fromMann").equals("1")) { tblFilters.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.FILTER)); tblMotors.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.AMOTOR)); tblAllMotors.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.AMOTOR)); tblOes.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.OE)); tblAllOes.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.OE)); } else { tblFilters.setDefaultRenderer(Object.class, new FilterTableCellRenderer()); } adjustButtonsEnabled(); // globalHotkeys(); }
From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java
@Override protected void setupSearchToolBar() { // additional functionality in Search panel: //final JPanel pnlCustomToolBarAreaSearch = new JPanel(); //pnlCustomToolBarAreaSearch.setLayout(new GridBagLayout()); super.setupSearchToolBar(); //final JToolBar toolbarSearchCustom = newCustomSearchToolBar(); if (SecurityCache.getInstance().isActionAllowed(Actions.ACTION_READ_DELETED_RECORD)) { //toolbarSearchCustom.add(Box.createHorizontalStrut(5)); //cmbbxSearchDeleted.addItem(SpringLocaleDelegate.getMessage("GenericObjectCollectController.59","Nur ungel\u00f6schte suchen")); //cmbbxSearchDeleted.addItem(SpringLocaleDelegate.getMessage("GenericObjectCollectController.58","Nur gel\u00f6schte suchen")); //cmbbxSearchDeleted.addItem(SpringLocaleDelegate.getMessage("GenericObjectCollectController.49","Gel\u00f6schte und ungel\u00f6schte suchen")); btnGrpSearchDeleted.add(miSearchDeleted[0]); btnGrpSearchDeleted.add(miSearchDeleted[1]); btnGrpSearchDeleted.add(miSearchDeleted[2]); btnGrpSearchDeleted.setSelected(miSearchDeleted[0].getModel(), true); //UIUtils.setMaximumSizeToPreferredSize(cmbbxSearchDeleted); //toolbarSearchCustom.add(cmbbxSearchDeleted); //this.getSearchPanel().addToolBarComponent(cmbbxSearchDeleted); this.getSearchPanel().addPopupExtraSeparator(); this.getSearchPanel().addPopupExtraMenuItem(miSearchDeleted[0]); this.getSearchPanel().addPopupExtraMenuItem(miSearchDeleted[1]); this.getSearchPanel().addPopupExtraMenuItem(miSearchDeleted[2]); /*cmbbxSearchDeleted.addItemListener(new ItemListener() { @Override//w ww. j a va 2 s . c o m public void itemStateChanged(ItemEvent ev) { if (ev.getStateChange() == ItemEvent.SELECTED) iSearchDeleted = cmbbxSearchDeleted.getSelectedIndex(); } });*/ ItemListener il = new ItemListener() { @Override public void itemStateChanged(ItemEvent ev) { if (ev.getStateChange() == ItemEvent.SELECTED) { for (int i = 0; i < miSearchDeleted.length; i++) { if (ev.getSource() == miSearchDeleted[i]) iSearchDeleted = i; } } } }; miSearchDeleted[0].addItemListener(il); miSearchDeleted[1].addItemListener(il); miSearchDeleted[2].addItemListener(il); } refreshFilterView(); // glue: //final JToolBar toolbarGlue = UIUtils.createNonFloatableToolBar(); // add toolbars to custom toolbar area: /*final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.VERTICAL; gbc.weightx = 0.0; gbc.weighty = 1.0; pnlCustomToolBarAreaSearch.add(toolbarSearchCustom, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; pnlCustomToolBarAreaSearch.add(toolbarGlue, gbc); gbc.fill = GridBagConstraints.VERTICAL; gbc.weightx = 0.0; gbc.weighty = 1.0; JToolBar toolSearchState = UIUtils.createNonFloatableToolBar(); */ JComboBox jComboBox = getSearchStateBox().getJComboBox(); //UIUtils.setMaximumSizeToPreferredSize(jComboBox); jComboBox.setToolTipText( getSpringLocaleDelegate().getMessage("GenericObjectCollectController.8", "Aktueller Status")); //jComboBox.setOpaque(false); //CenteringPanel cpSearchState = new CenteringPanel(jComboBox); //cpSearchState.setOpaque(false); //toolSearchState.add(cpSearchState); //toolSearchState.add(Box.createHorizontalStrut(5)); ColoredLabel lbSearchBox = new ColoredLabel(jComboBox, getSpringLocaleDelegate().getMessage("nuclos.entityfield.eo.state.label", "Status")); lbSearchBox.setName("blSearchState"); this.getSearchPanel().addToolBarComponent(lbSearchBox, 6); //pnlCustomToolBarAreaSearch.add(toolSearchState, gbc); setSearchStatesAccordingToUsageCriteria(new UsageCriteria(iModuleId, null, null, getCustomUsage())); //getSearchPanel().setCustomToolBarArea(pnlCustomToolBarAreaSearch); }