List of usage examples for java.awt.event ItemEvent getStateChange
public int getStateChange()
From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java
/** * Class Constructor.//from w ww . j av a 2 s. c om */ public BusinessQueryPanel(final FindParamsPanel findParamsPanel, ConfigurationType uiConfigurationType) throws JAXRException { super(findParamsPanel, uiConfigurationType); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); objectTypeLabel = new JLabel(resourceBundle.getString("title.objectType"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(objectTypeLabel, c); add(objectTypeLabel); //TODO: SwingBoost: Localize this TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types..."); objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode)); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(objectTypeCombo, c); add(objectTypeCombo); objectTypeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ev) { if (ev.getStateChange() == ItemEvent.DESELECTED) { return; } @SuppressWarnings("unused") String objectType = getObjectType().toString(); } }); //The caseSensitive CheckBox caseSensitiveCheckBox = new JCheckBox(resourceBundle.getString("title.caseSensitiveSearch")); caseSensitiveCheckBox.setSelected(false); caseSensitiveCheckBox.setEnabled(true); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(caseSensitiveCheckBox, c); add(caseSensitiveCheckBox); //The name Text nameLabel = new JLabel(resourceBundle.getString("title.name"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(nameLabel, c); add(nameLabel); nameText = new JTextField(); c.gridx = 0; c.gridy = 4; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(nameText, c); add(nameText); nameText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //The description text descLabel = new JLabel(resourceBundle.getString("title.description"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(descLabel, c); add(descLabel); descText = new JTextField(); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(descText, c); add(descText); descText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //Classifications classificationsLabel = new JLabel(resourceBundle.getString("title.classifications"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 7; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(classificationsLabel, c); add(classificationsLabel); classificationsList = new ClassificationsList(); classificationsList.setEditable(true); classificationsList.setVisibleRowCount(3); JScrollPane classificationsListScrollPane = new JScrollPane(classificationsList); //Workaround for bug 740746 where very wide item resulted in too short a height classificationsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 8; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(classificationsListScrollPane, c); add(classificationsListScrollPane); //Identifiers identifiersLabel = new JLabel(resourceBundle.getString("title.externalIdentifiers"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 9; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(identifiersLabel, c); add(identifiersLabel); extIdsList = new ExternalIdentifiersList(); extIdsList.setEditable(true); extIdsList.setVisibleRowCount(3); JScrollPane extIdsListScrollPane = new JScrollPane(extIdsList); //Workaround for bug 740746 where very wide item resulted in too short a height extIdsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(extIdsListScrollPane, c); add(extIdsListScrollPane); //External Links linksLabel = new JLabel(resourceBundle.getString("title.externalLinks"), SwingConstants.TRAILING); c.gridx = 0; c.gridy = 11; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(linksLabel, c); add(linksLabel); linksList = new ExternalLinksList(); linksList.setEditable(true); linksList.setVisibleRowCount(3); JScrollPane linksListScrollPane = new JScrollPane(linksList); //Workaround for bug 740746 where very wide item resulted in too short a height linksListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 12; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(linksListScrollPane, c); add(linksListScrollPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:coolmap.canvas.datarenderer.renderer.impl.NumberComposite.java
public NumberComposite() { setName("Number to Composite"); // System.out.println("Created a new NumberComposite"); setDescription("A renderer that can be used to assign renderers to different aggregations"); configUI.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0;//from w ww. j a v a 2 s . c om c.gridy = 0; c.ipadx = 5; c.ipady = 5; c.insets = new Insets(2, 2, 2, 2); c.gridwidth = 1; //This combo box will need to be able to add registered singleComboBox = new JComboBox(); rowComboBox = new JComboBox(); columnComboBox = new JComboBox(); rowColumnComboBox = new JComboBox(); singleLegend = new JLabel(); rowLegend = new JLabel(); columnLegend = new JLabel(); rowColumnLegend = new JLabel(); singleLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); rowLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); columnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); rowColumnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); //Add them JLabel label = new JLabel("Default:"); label.setToolTipText("Default renderer"); c.gridx = 0; c.gridy++; configUI.add(label, c); c.gridx = 1; configUI.add(singleComboBox, c); singleComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 2; JButton config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (singleRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), singleRenderer.getConfigUI(), "Default Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(singleLegend, c); ////////////////////////////////////////////////////////////// c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Row Group:"); label.setToolTipText("Renderer for row ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(rowComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (rowGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), rowGroupRenderer.getConfigUI(), "Row Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); rowComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(rowLegend, c); c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Column Group:"); label.setToolTipText("Renderer for column ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(columnComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (columnGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), columnGroupRenderer.getConfigUI(), "Column Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(columnLegend, c); columnComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Row & Column Group:"); label.setToolTipText("Renderer for row and column ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(rowColumnComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (rowColumnGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), rowColumnGroupRenderer.getConfigUI(), "Row + Column Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); rowColumnComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(rowColumnLegend, c); JButton button = new JButton("Apply Changes", UI.getImageIcon("refresh")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateRenderer(); } }); c.gridx = 0; c.gridy++; c.gridwidth = 2; configUI.add(button, c); singleComboBox.setRenderer(new ComboRenderer()); rowComboBox.setRenderer(new ComboRenderer()); columnComboBox.setRenderer(new ComboRenderer()); rowColumnComboBox.setRenderer(new ComboRenderer()); _updateLists(); }
From source file:op.care.prescription.DlgOnDemand.java
private void rbActiveItemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { txtOFF.setText(null);//from w w w .jav a2 s . com } }
From source file:op.care.med.inventory.DlgNewStocks.java
private void cmbBWItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbBWItemStateChanged if (ignoreEvent || (evt != null && evt.getStateChange() != ItemEvent.SELECTED)) { return;//w w w. j a v a 2 s . c o m } resident = (Resident) cmbBW.getSelectedItem(); OPDE.debug("cmbPackungItemStateChanged: " + cmbBW.getSelectedItem()); initCmbVorrat(); setApply(); }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void businessLayerComboItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_businessLayerComboItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { changeBusinessLayer(getBusinessLayer()); setCompleteApplicationCompVisibility( getBusinessLayer().getTechnology().panel() != LayerConfigPanel.class); }/*from w w w. j a v a 2 s. c om*/ }
From source file:op.care.med.inventory.DlgNewStocks.java
private void cmbPackungItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbPackungItemStateChanged if (ignoreEvent || (evt != null && evt.getStateChange() != ItemEvent.SELECTED)) { return;/* www. j a v a 2s. c om*/ } OPDE.debug("cmbPackungItemStateChanged: " + cmbPackung.getSelectedItem()); if (cmbPackung.getSelectedItem() instanceof MedPackage) { aPackage = (MedPackage) cmbPackung.getSelectedItem(); } else { aPackage = null; } txtMenge.setText(""); }
From source file:op.care.prescription.DlgOnDemand.java
private void rbDateItemStateChanged(ItemEvent e) { txtOFF.setEnabled(e.getStateChange() == ItemEvent.SELECTED); if (e.getStateChange() == ItemEvent.SELECTED) { txtOFF.setText(DateFormat.getDateInstance().format(new Date())); }//from w ww .j a va 2s. c o m }
From source file:op.controlling.PnlQMSSchedule.java
private void initPanel() { i18n();//from ww w . java 2 s. com txtDueDays.setText(Integer.toString(qmssched.getDuedays())); spinTaeglich.setModel(new SpinnerNumberModel(1, 1, 365, 1)); spinWoche.setModel(new SpinnerNumberModel(1, 1, 52, 1)); spinMonat.setModel(new SpinnerNumberModel(1, 1, 12, 1)); spinYearly.setModel(new SpinnerNumberModel(1, 1, 10, 1)); spinDayInMonth.setModel(new SpinnerNumberModel(1, 1, 31, 1)); spinTaeglich.setValue(Math.max(qmssched.getDaily(), 1)); spinWoche.setValue(Math.max(qmssched.getWeekly(), 1)); spinMonat.setValue(Math.max(qmssched.getMonthly(), 1)); spinDayInMonth.setValue(Math.max(qmssched.getDayinmonth(), 1)); spinYearly.setValue(Math.max(qmssched.getYearly(), 1)); cbMon.setSelected(true); cmbMonth.setSelectedIndex(qmssched.isYearly() ? qmssched.getMonthinyear() - 1 : 0); spinDayInMonthInYear.setModel(new SpinnerNumberModel(qmssched.isYearly() ? qmssched.getDayinmonth() : 1, 1, maxdays[cmbMonth.getSelectedIndex()], 1)); cmbMonth.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { spinDayInMonthInYear .setModel(new SpinnerNumberModel(1, 1, maxdays[cmbMonth.getSelectedIndex()], 1)); } } }); if (qmssched.isDaily()) { tabWdh.setSelectedIndex(TAB_DAILY); } else if (qmssched.isWeekly()) { cbMon.setSelected(qmssched.getWeekday() == DateTimeConstants.MONDAY); cbDie.setSelected(qmssched.getWeekday() == DateTimeConstants.TUESDAY); cbMit.setSelected(qmssched.getWeekday() == DateTimeConstants.WEDNESDAY); cbDon.setSelected(qmssched.getWeekday() == DateTimeConstants.THURSDAY); cbFre.setSelected(qmssched.getWeekday() == DateTimeConstants.FRIDAY); cbSam.setSelected(qmssched.getWeekday() == DateTimeConstants.SATURDAY); cbSon.setSelected(qmssched.getWeekday() == DateTimeConstants.SUNDAY); tabWdh.setSelectedIndex(TAB_WEEKLY); } else if (qmssched.isMonthly()) { spinDayInMonth.setValue(qmssched.getDayinmonth()); cmbTag.setSelectedIndex(qmssched.getWeekday()); tabWdh.setSelectedIndex(TAB_MONTHLY); } else if (qmssched.isYearly()) { spinYearly.setValue(qmssched.getYearly()); spinDayInMonthInYear.setValue(qmssched.getDayinmonth()); cmbMonth.setSelectedIndex(qmssched.getMonthinyear() - 1); tabWdh.setSelectedIndex(TAB_YEARLY); } jdcStartingOn.setMinSelectableDate(new Date()); jdcStartingOn.setDate(qmssched.getStartingOn()); ArrayList<Date> timelist = SYSCalendar.getTimeList(); DefaultComboBoxModel dcbm = new DefaultComboBoxModel(timelist.toArray()); dcbm.insertElementAt(null, 0); txtBemerkung.setText(qmssched.getText()); txtQMS.setText(qmssched.getMeasure()); cmbLocation.setTreeModel(new DefaultTreeModel(StationTools.getCompleteStructure())); Object userObject = null; if (qmssched.getHome() != null) { userObject = qmssched.getHome(); } else if (qmssched.getStation() != null) { userObject = qmssched.getStation(); } int row = 0; if (userObject == null) { cmbLocation.setSelectedItem(null); } else { DefaultMutableTreeNode root = (DefaultMutableTreeNode) cmbLocation.getTreeModel().getRoot(); DefaultMutableTreeNode theNode = null; for (Enumeration e = root.depthFirstEnumeration(); e.hasMoreElements() && theNode == null;) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement(); if (userObject.equals(node.getUserObject())) { cmbLocation.setSelectedItem(node); break; } row++; } } }
From source file:op.care.med.inventory.DlgNewStocks.java
private void cmbMProduktItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbMProduktItemStateChanged if (ignoreEvent || (evt != null && evt.getStateChange() != ItemEvent.SELECTED)) { return;/* w w w .j a v a2 s . com*/ } tradeForm = (TradeForm) cmbMProdukt.getSelectedItem(); if (tradeForm != null) { DefaultComboBoxModel dcbm = new DefaultComboBoxModel(tradeForm.getPackages().toArray()); txtWeightControl.setVisible(tradeForm.isWeightControlled()); lblWeightControl.setVisible(tradeForm.isWeightControlled()); dcbm.insertElementAt("<Sonderpackung>", 0); cmbPackung.setModel(dcbm); cmbPackung.setRenderer(MedPackageTools.getMedPackungRenderer()); if (aPackage == null) { cmbPackung.setSelectedIndex(cmbPackung.getModel().getSize() - 1); } else { cmbPackung.setSelectedItem(aPackage); } cmbPackungItemStateChanged(null); } else { cmbPackung.setModel(new DefaultComboBoxModel()); aPackage = null; txtWeightControl.setVisible(false); lblWeightControl.setVisible(false); } initCmbVorrat(); }
From source file:com.frochr123.fabqr.gui.FabQRUploadDialog.java
public FabQRUploadDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); // Initialization initComponents();/* w w w . ja v a 2s .c o m*/ this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); initWindowListener(); // Set correct language for combobox license after initComponents() String[] localizedComboboxLicenseItems = new String[] { bundle.getString("CC0"), bundle.getString("CCBY"), bundle.getString("CCBYSA"), bundle.getString("CCBYNC"), bundle.getString("CCBYND"), bundle.getString("CCBYNCSA"), bundle.getString("CCBYNCND") }; DefaultComboBoxModel localizedComboboxLicenseItemsModel = new javax.swing.DefaultComboBoxModel( localizedComboboxLicenseItems); cmbbxLicense.setModel(localizedComboboxLicenseItemsModel); // Change camera thread on switch buttons ItemListener buttonChangeListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { // One button change causes SELECTED and DESELECTED, only react to SELECTED if (e.getStateChange() == ItemEvent.SELECTED) { // Stop old camera thread and start new one with new settings closeCamera(); setupCamera(); } } }; rdbtnWebcam.addItemListener(buttonChangeListener); rdbtnVisicam.addItemListener(buttonChangeListener); // Set default status message showStatus(bundle.getString("INFO_WAITING_FOR_USER_INPUT")); // Start capturing setupCamera(); }