Java 类java.awt.event.ItemListener 实例源码

项目:my-diploma-work    文件:IngredientsFrame.java   
public void addCheckBoxToPanel(Food food) {
    JFrame frame = this;
    jPanel2.setLayout(new GridLayout(0, 4));
    final JCheckBox box = new JCheckBox(food.getFood());
    box.setActionCommand(String.valueOf(food.getId()));
    box.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (box.isSelected()) {
                jTextArea1.append(box.getText() + "\n");
                selectedFoodIds.add(Integer.parseInt(box.getActionCommand()));
            }
        }
    });
    jPanel2.add(box);
    frame.revalidate();
    frame.repaint();
}
项目:cuttlefish    文件:GroupPanel.java   
/**
 * activates or deactivates the widget in the panel
 * @param activated boolean true to activate and false to deactivate
 */
public void setActivated(boolean activated) {
    if(widget!=null && widget.isClickable()){
        widget.setActive(activated);
        if(activated){
            labelPanel.setBackground(highlightColor);
            jLabel.setForeground(Color.GRAY);
        }else{
            labelPanel.setBackground(Color.GRAY);
            jLabel.setForeground(highlightColor);
        }
        if(widget!=null){
            widget.onActiveChanged();
        }
        //notify the listeners over the widet the state change event
        for(ItemListener listener: listeners){
            ItemEvent e = new ItemEvent(this,0,widget, isActivated() ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
            listener.itemStateChanged(e);
        }
    }
}
项目:incubator-netbeans    文件:ActionFactory.java   
public JMenuItem getPopupMenuItem(JTextComponent target) {

    item = new JCheckBoxMenuItem(NbBundle.getBundle(BaseKit.class).
            getString("line-numbers-menuitem"), isLineNumbersVisible());
    item.addItemListener( new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            actionPerformed(null,null);
        }
    });
    return item;
}
项目:incubator-netbeans    文件:InternationalizationResourceBundleBrandingPanel.java   
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);
                            }
                        }
                    });
                }
            });
        }
    });
}
项目:incubator-netbeans    文件:GitCommitPanel.java   
public static GitCommitPanel create(final File[] roots, final File repository, GitUser user, boolean fromGitView) {
    Preferences preferences = GitModuleConfig.getDefault().getPreferences();
    String lastCanceledCommitMessage = GitModuleConfig.getDefault().getLastCanceledCommitMessage();

    GitCommitParameters parameters = new GitCommitParameters(preferences, lastCanceledCommitMessage, user);

    Collection<GitHook> hooks = VCSHooks.getInstance().getHooks(GitHook.class);
    GitHookContext hooksCtx = new GitHookContext(roots, null, new GitHookContext.LogEntry[] {});        

    DiffProvider diffProvider = new DiffProvider();
    final GitCommitTable gitCommitTable = new GitCommitTable();
    final CommitPanel panel = parameters.getPanel();
    panel.amendCheckBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            gitCommitTable.setAmend(panel.amendCheckBox.isSelected());
        }
    });
    return new GitCommitPanel(gitCommitTable, roots, repository, parameters, preferences, hooks, hooksCtx, diffProvider, fromGitView, createFilters(fromGitView));
}
项目:incubator-netbeans    文件:UnboundTargetAlert.java   
/**
 * 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;
}
项目:etomica    文件:DeviceSelector.java   
public DeviceSelector(Controller controller) {
    super(controller);
    selector = new javax.swing.JComboBox();
    label = new javax.swing.JLabel("");

    panel = new javax.swing.JPanel(new java.awt.BorderLayout(0,1));
    panel.add(label, java.awt.BorderLayout.NORTH);
    panel.add(selector, java.awt.BorderLayout.SOUTH);
    panel.setBorder(new javax.swing.border.EmptyBorder(3,3,3,3));
    actionHash = new HashMap<String,IAction>();

    //listener to combo box gets value and initiates action
    selector.addItemListener( new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            if (event.getStateChange() == ItemEvent.DESELECTED) return;
            IAction action = actionHash.get(event.getItem());
            doAction(action);
        }
    });
}
项目:incubator-netbeans    文件:NbEditorKit.java   
public @Override JMenuItem getPopupMenuItem(JTextComponent target) {
    Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
    boolean toolbarVisible = prefs.getBoolean(SimpleValueNames.TOOLBAR_VISIBLE_PROP, EditorPreferencesDefaults.defaultToolbarVisible);

    JCheckBoxMenuItem item = new JCheckBoxMenuItem(
        NbBundle.getBundle(ToggleToolbarAction.class).getString("PROP_base_toolbarVisible"), //NOI18N
        toolbarVisible);

    item.addItemListener( new ItemListener() {
        public @Override void itemStateChanged(ItemEvent e) {
            actionPerformed(null,null);
        }
    });

    return item;
}
项目:openjdk-jdk10    文件:Test4319113.java   
private void show(Window window) {
    JButton jButton = new JButton("Show ColorChooser");
    jButton.setActionCommand("Show ColorChooser");
    jButton.addActionListener(this);
    this.cbPlaf = new JComboBox<UIManager.LookAndFeelInfo>(UIManager.getInstalledLookAndFeels());
    this.cbPlaf.addItemListener(new ItemListener(){

        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() == 1) {
                SwingUtilities.invokeLater(new Runnable(){

                    @Override
                    public void run() {
                        UIManager.LookAndFeelInfo lookAndFeelInfo = (UIManager.LookAndFeelInfo)Test4319113.this.cbPlaf.getSelectedItem();
                        try {
                            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                            Frame[] arrframe = Frame.getFrames();
                            int n = arrframe.length;
                            while (--n >= 0) {
                                Test4319113.updateWindowTreeUI(arrframe[n]);
                            }
                        }
                        catch (Exception var2_3) {
                            System.err.println("Exception while changing L&F!");
                        }
                    }
                });
            }
        }

    });
    window.add(this.cbPlaf);
    window.add(jButton);
    window.pack();
    window.setVisible(true);
}
项目:AgentWorkbench    文件:Distribution.java   
/**
 * This method initializes jComboBoxJVMMemoryMaximum    
 * @return javax.swing.JComboBox    
 */
private JComboBox<String> getJComboBoxJVMMemoryMaximum() {
    if (jComboBoxJVMMemoryMaximum == null) {
        jComboBoxJVMMemoryMaximum = new JComboBox<String>();
        jComboBoxJVMMemoryMaximum.setModel(comboModelMaximal);
        jComboBoxJVMMemoryMaximum.setPreferredSize(new Dimension(80, 26));
        jComboBoxJVMMemoryMaximum.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent ie) {
                if (ie.getStateChange()==ItemEvent.SELECTED) {
                    @SuppressWarnings("unchecked")
                    JComboBox<String> combo = (JComboBox<String>) ie.getSource();
                    if (isMemorySelectionError(combo)==false) {
                        // --- Save in project ------------
                        currRemoteContainerConfiguration.setJvmMemAllocMaximum((String) jComboBoxJVMMemoryMaximum.getSelectedItem());
                        currProject.setRemoteContainerConfiguration(currRemoteContainerConfiguration);
                    } else {
                        // --- Set back to old value ------
                        getJComboBoxJVMMemoryMaximum().setSelectedItem(currRemoteContainerConfiguration.getJvmMemAllocMaximum());
                    }
                }
            }
        });
    }
    return jComboBoxJVMMemoryMaximum;
}
项目:rapidminer    文件:ConfigureDataTableHeader.java   
/**
 * @return menu that allows to select possible column types
 */
private JMenu createTypeMenu() {
    ButtonGroup typeGroup = new ButtonGroup();
    JMenu typeChangeItem = new JMenu(CHANGE_TYPE_LABEL);
    typeChangeItem.setToolTipText(CHANGE_TYPE_TIP);
    for (final ColumnType columnType : ColumnType.values()) {
        final JCheckBoxMenuItem checkboxItem = new JCheckBoxMenuItem(
                DataImportWizardUtils.getNameForColumnType(columnType));
        if (columnType == metaData.getColumnMetaData(columnIndex).getType()) {
            checkboxItem.setSelected(true);
        }
        checkboxItem.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    changeType(columnType);
                }

            }
        });
        typeGroup.add(checkboxItem);
        typeChangeItem.add(checkboxItem);
    }
    return typeChangeItem;
}
项目:rapidminer    文件:InnerOperatorValueCellEditor.java   
private void updateOperatorCombo() {
    Object selectedItem = this.operatorCombo.getSelectedItem();
    this.operatorCombo.removeAllItems();
    List<Operator> allInnerOps = parentOperator.getAllInnerOperators();
    Vector<String> allOpNames = new Vector<String>();
    Iterator<Operator> i = allInnerOps.iterator();
    while (i.hasNext()) {
        allOpNames.add(i.next().getName());
    }
    Collections.sort(allOpNames);
    Iterator<String> s = allOpNames.iterator();
    while (s.hasNext()) {
        this.operatorCombo.addItem(s.next());
    }
    this.operatorCombo.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            fireEditingStopped();
        }
    });
    if (this.operatorCombo.getItemCount() == 0) {
        this.operatorCombo.addItem("add inner operators");
    }
    this.operatorCombo.setSelectedItem(selectedItem);
}
项目:jmt    文件:DefaultsEditor.java   
/**
 * Adds an input field to select from a ComboBox
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 * @param values Map with internal value <-> showed value relations
 */
protected void addInputCombo(String text, final String property, Container cont, final Map<String, String> values) {
    JLabel label = new JLabel(text + ":");
    JComboBox combo = new JComboBox(values.values().toArray());
    combo.setName(property);
    label.setLabelFor(combo);
    combo.setSelectedItem(values.get(Defaults.get(property)));
    // Sets maximum size to minimal one, otherwise springLayout will stretch this
    combo.setMaximumSize(new Dimension(combo.getMaximumSize().width, combo.getMinimumSize().height));
    combo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            // As Map does not allows reverse mapping, scans the entire keyset to
            // find the key corresponding to a given object
            Object[] keys = values.keySet().toArray();
            for (Object key : keys) {
                if (values.get(key) == e.getItem()) {
                    Defaults.set(property, (String) key);
                }
            }
        }
    });
    cont.add(label);
    cont.add(combo);
}
项目:jmt    文件:DefaultsEditor.java   
/**
 * Adds a ComboBox to select a boolean property
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 */
protected void addBooleanComboBox(String text, final String property, Container cont) {
    JLabel label = new JLabel(text + ":");
    JComboBox combo = new JComboBox(new Object[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() });
    combo.setName(property);
    label.setLabelFor(combo);
    combo.setSelectedItem(Defaults.get(property));
    // Sets maximum size to minimal one, otherwise springLayout will stretch this
    combo.setMaximumSize(new Dimension(combo.getMaximumSize().width, combo.getMinimumSize().height));
    combo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            Defaults.set(property, (String) e.getItem());
        }
    });
    cont.add(label);
    cont.add(combo);
}
项目:Laserscan-to-dxf    文件:CheckBoxWithText.java   
/**
 * 
 */
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);
            }
        }

    });
}
项目:VASSAL-src    文件:ColorSwatchConfigurer.java   
protected void buildSwatches() {
  if (swatchPanel == null) {
    return;
  }

  if (swatches != null) {
    swatchPanel.remove(swatches);
  }

  ItemListener l = new ItemListener() {
    public void itemStateChanged(ItemEvent evt) {
      updateValue();
    }
  };

  swatches = new SwatchComboBox(l, ((ColorSwatch) value).getConfigureName());
  swatchPanel.add(swatches);

}
项目:MailCopier    文件:SettingsForm.java   
private JComboBox<String> get_language_comb() {
    if(language_comb == null) {
        String[] langs = {"Spanish", "English"};
        language_comb = new JComboBox<String>(langs);
        switch(pManager.get_Location()) {
        case "Spanish":
            language_comb.setSelectedItem("Spanish");
            break;
        default:
            language_comb.setSelectedItem("English");
        }
        language_comb.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent evt) {
                    if(evt.getStateChange() == ItemEvent.SELECTED) {
                        if(language_banner) {return;}
                        String title = pManager.get_String("warning");
                        String message = pManager.get_String("language_message");
                        boolean sound = pManager.get_sounds_status();
                        Notification.show(title, message, sound, Notification.WARNING_MESSAGE);
                        language_banner = true;
                    }
                }
            });
    }
    return language_comb;
}
项目:Equella    文件:ShowHideComponent.java   
public ShowHideComponent(final AbstractButton button, T comp)
{
    this.button = button;
    this.comp = comp;

    button.addItemListener(new ItemListener()
    {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
            updateState();
        }
    });

    setLayout(new MigLayout("insets 0, wrap, hidemode 3", "[grow]", "[][grow]"));
    add(button);
    add(comp, "gap indent, grow");

    updateState();
}
项目:QN-ACTR-Release    文件:DefaultsEditor.java   
/**
 * Adds an input field to select from a ComboBox
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 * @param values Map with internal value <-> showed value relations
 */
protected void addInputCombo(String text, final String property, Container cont, final Map<String, String> values) {
    JLabel label = new JLabel(text + ":");
    JComboBox combo = new JComboBox(values.values().toArray());
    combo.setName(property);
    label.setLabelFor(combo);
    combo.setSelectedItem(values.get(Defaults.get(property)));
    // Sets maximum size to minimal one, otherwise springLayout will stretch this
    combo.setMaximumSize(new Dimension(combo.getMaximumSize().width, combo.getMinimumSize().height));
    combo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            // As Map does not allows reverse mapping, scans the entire keyset to
            // find the key corresponding to a given object
            Object[] keys = values.keySet().toArray();
            for (Object key : keys) {
                if (values.get(key) == e.getItem()) {
                    Defaults.set(property, (String) key);
                }
            }
        }
    });
    cont.add(label);
    cont.add(combo);
}
项目:Hotel-Properties-Management-System    文件:Main_BottomToolbar.java   
private ItemListener showWeather() {
    final ItemListener listener = new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (checkBox.isSelected() == true) {

                final HotelDaoImpl hotelDaoImpl = new HotelDaoImpl();
                final Hotel hotel = hotelDaoImpl.getHotel();
                final String city = liveWeather.getCurrentLocationWeather(hotel.getCity());
                weatherLabel.setEnabled(true);
                weatherLabel.setText(city);

            } else {
                weatherLabel.setEnabled(false);
                weatherLabel.setText("");
            }

        }
    };

    return listener;
}
项目:Hotel-Properties-Management-System    文件:CustomerForm.java   
private ItemListener changeTitleListener() {
    final ItemListener listener = new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            final String title = titleComboBox.getSelectedItem().toString();

            if(title.equalsIgnoreCase("Mr")) {
                genderComboBox.setSelectedIndex(0);
                genderComboBox.revalidate();
                genderComboBox.repaint();
            }

            else {
                genderComboBox.setSelectedIndex(1);
                genderComboBox.revalidate();
                genderComboBox.repaint();
            }
        }
    };
    return listener;
}
项目:JavaGraph    文件:RuleTree.java   
/**
 * Sets a listener to the anchor image option, if that has not yet been
 * done.
 */
private void setShowAnchorsOptionListener() {
    if (!this.anchorImageOptionListenerSet) {
        JMenuItem showAnchorsOptionItem = getSimulator().getOptions()
            .getItem(Options.SHOW_ANCHORS_OPTION);
        if (showAnchorsOptionItem != null) {
            // listen to the option controlling the rule anchor display
            showAnchorsOptionItem.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    suspendListeners();
                    refresh(getSimulatorModel().getState());
                    activateListeners();
                }
            });
            this.anchorImageOptionListenerSet = true;
        }
    }
}
项目:JavaGraph    文件:CheckboxTree.java   
/** Constructs a new editor for the enclosing tree. */
public CellEditor(CheckboxTree tree) {
    this.tree = tree;
    this.editor = tree.createRenderer();
    ItemListener itemListener = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (!CellEditor.this.editor.isInitialising()) {
                stopCellEditing();
                TreeNode editedNode = getInner().getTreeNode();
                editedNode.setSelected(itemEvent.getStateChange() == ItemEvent.SELECTED);
            }
        }
    };
    getInner().getCheckbox().addItemListener(itemListener);
}
项目:JavaGraph    文件:Options.java   
/**
 * Adds a checkbox item with a given name to the options, and returns the
 * associated (fresh) menu item.
 * @param name the name of the checkbox menu item to add
 * @return the added {@link javax.swing.JCheckBoxMenuItem}
 */
private final JCheckBoxMenuItem addCheckbox(final String name) {
    JCheckBoxMenuItem result = new JCheckBoxMenuItem(name);
    boolean selected = userPrefs.getBoolean(name, boolOptionDefaults.get(name));
    boolean enabled = isEnabled(name);
    result.setSelected(selected & enabled);
    this.itemMap.put(name, result);
    if (enabled) {
        result.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                userPrefs.putBoolean(name, e.getStateChange() == ItemEvent.SELECTED);
            }
        });
    } else {
        result.setEnabled(false);
    }
    return result;
}
项目:s-store    文件:TableGui.java   
private void enableTableOptions()
{
    m_checkLinkCsv.setEnabled(true);
    String sCsvLink = TableEnv.getTableCsvLink(m_lstTblName.getSelectedValue().toString());
    if (sCsvLink != null)
    {
        m_txtLinkCsvPath.setText(CsvLinkStatus.LINKED.m_sStatus + sCsvLink);
        // disable check box listener for one moment
        ItemListener listener = m_checkLinkCsv.getItemListeners()[0];
        m_checkLinkCsv.removeItemListener(listener);
        m_checkLinkCsv.setSelected(true);
        m_checkLinkCsv.addItemListener(listener);
    }
    else
    {
        m_txtLinkCsvPath.setText(CsvLinkStatus.UNLINKED.m_sStatus);
        m_checkLinkCsv.setSelected(false);
    }

    m_txtCardinality.setEnabled(true);
}
项目:openjdk-jdk10    文件:CheckboxOperator.java   
/**
 * Maps {@code Checkbox.removeItemListener(ItemListener)} through queue
 */
public void removeItemListener(final ItemListener itemListener) {
    runMapping(new MapVoidAction("removeItemListener") {
        @Override
        public void map() {
            ((Checkbox) getSource()).removeItemListener(itemListener);
        }
    });
}
项目:incubator-netbeans    文件:SearchPatternController.java   
/**
 * Bind an abstract button (usually checkbox) to a SearchPattern option.
 *
 * @param option Option whose value the button should represent.
 * @param button Button to control and display the option.
 */
public void bind(@NonNull final Option option,
        @NonNull final AbstractButton button) {
    Parameters.notNull("option", option);                           //NOI18N
    Parameters.notNull("button", button);                           //NOI18N

    if (bindings.containsKey(option)) {
        throw new IllegalStateException(
                "Already binded with option " + option);           // NOI18N
    }

    bindings.put(option, button);
    button.setSelected(getOption(option));
    button.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            setOption(option, button.isSelected());
        }
    });
}
项目:openjdk-jdk10    文件:ListOperator.java   
/**
 * Maps {@code List.addItemListener(ItemListener)} through queue
 */
public void addItemListener(final ItemListener itemListener) {
    runMapping(new MapVoidAction("addItemListener") {
        @Override
        public void map() {
            ((List) getSource()).addItemListener(itemListener);
        }
    });
}
项目:incubator-netbeans    文件:PersistenceUnitWizardPanelJdbc.java   
public PersistenceUnitWizardPanelJdbc(final Project project, ChangeListener changeListener,
        boolean editName, TableGeneration tg) {

    super(project);
    initComponents();
    setTableGeneration(tg);
    libraryCombo.setEnabled(false);

    RP.post(new Runnable() {
       @Override
       public void run() {
            PersistenceProviderComboboxHelper comboHelper = new PersistenceProviderComboboxHelper(project);
            comboHelper.connect(libraryCombo);
            libraryCombo.setEnabled(true);
            checkValidity();
       } 
    });


    unitNameTextField.setText(Util.getCandidateName(project));
    unitNameTextField.selectAll();
    // unit name editing is not available when adding first PU
    unitNameTextField.setVisible(editName);
    unitNameLabel.setVisible(editName);

    DatabaseExplorerUIs.connect(jdbcCombo, ConnectionManager.getDefault());
    jdbcCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            checkValidity();
        }
    });

    unitNameTextField.getDocument().addDocumentListener(new ValidationListener());
    errorMessage.setForeground(Color.RED);
            updateWarning();
}
项目:incubator-netbeans    文件:JavaTestCreatorConfiguration.java   
private void setupUserInteraction(Callback callback) {
    final ItemListener listener = new CheckBoxListener(callback);

    chkPublic.addItemListener(listener);
    chkProtected.addItemListener(listener);
    chkPackage.addItemListener(listener);
}
项目:incubator-netbeans    文件:WindowSystemBrandingPanel.java   
public WindowSystemBrandingPanel(BrandingModel model) {
    super(NbBundle.getMessage(BasicBrandingPanel.class, "LBL_WindowSystemTab"), model); //NOI18N

    initComponents();
    refresh();
    enableDisableComponents();

    ItemListener listener = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            setModified();
        }
    };
    cbEnableDnd.addItemListener(listener);
    cbEnableEditorClosing.addItemListener(listener);
    cbEnableFloating.addItemListener(listener);
    cbEnableMaximization.addItemListener(listener);
    cbEnableMinimumSize.addItemListener(listener);
    cbEnableResizing.addItemListener(listener);
    cbEnableSliding.addItemListener(listener);
    cbEnableViewClosing.addItemListener(listener);
    cbEnableAutoSlideInMinimizedMode.addItemListener( listener );
    cbEnableEditorModeDnD.addItemListener( listener );
    cbEnableEditorModeUndocking.addItemListener( listener );
    cbEnableModeClosing.addItemListener( listener );
    cbEnableModeSliding.addItemListener( listener );
    cbEnableViewModeDnD.addItemListener( listener );
    cbEnableViewModeUndocking.addItemListener( listener );
}
项目:Equella    文件:ScriptTab.java   
private void setupGui()
{
    nameLabel = new JLabel(s("name"));
    name = new I18nTextField(BundleCache.getLanguages());

    descriptionLabel = new JLabel(s("description"));
    description = new I18nTextArea(BundleCache.getLanguages());
    description.setTextRows(5);

    moveToLive = new JCheckBox(s("move"));
    moveToLive.addItemListener(new ItemListener()
    {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
            enableMoveToLive(moveToLive.isSelected());
        }
    });

    moveToLiveGroup = new ButtonGroup();
    moveToLiveArrival = new JRadioButton(s("move.arrival"));
    moveToLiveAccept = new JRadioButton(s("move.acceptance"));
    moveToLiveGroup.add(moveToLiveArrival);
    moveToLiveGroup.add(moveToLiveAccept);

    proceedNext = new JCheckBox(s("proceed.next"));
    proceedExplanation = new JLabel("<html>" + s("proceed.explanation"));

    scriptLabel = new JLabel(s("scriptlabel"));
    script = new EquellaSyntaxTextArea(100, 200);
    script.addFocusListener(this);
    script.addCaretListener(this);

    statusbar = new JStatusBar(EditorHelper.getStatusBarSpinner());
}
项目:incubator-netbeans    文件:ValueCellEditor.java   
public ValueCellEditor() {
    textEditor = new JTextField();
    booleanEditor = new JCheckBox();
    booleanEditor.setOpaque(false);
    booleanEditor.getModel().addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            stopCellEditing();
        }
    });

    booleanLabel = new JCheckBox();
    booleanLabel.setOpaque(false);
    label = new JLabel();
    label.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 5));
}
项目:Equella    文件:GroupBox.java   
@Override
public void itemStateChanged(final ItemEvent e)
{
    if( allowSetEnable )
    {
        setAllEnabled(e.getStateChange() == ItemEvent.SELECTED);
    }

    for( final ItemListener listener : listenerList.getListeners(ItemListener.class) )
    {
        listener.itemStateChanged(e);
    }
}
项目:openjdk-jdk10    文件:JComboBoxOperator.java   
/**
 * Maps {@code JComboBox.addItemListener(ItemListener)} through queue
 */
public void addItemListener(final ItemListener itemListener) {
    runMapping(new MapVoidAction("addItemListener") {
        @Override
        public void map() {
            ((JComboBox) getSource()).addItemListener(itemListener);
        }
    });
}
项目:Yass    文件:Tap.java   
/**
 * Gets the contentPanel attribute of the Tap object
 *
 * @return The contentPanel value
 */
private JPanel getContentPanel() {
    JPanel content = new JPanel(new BorderLayout());
    JTextPane txt = new JTextPane();
    HTMLDocument doc = (HTMLDocument) txt.getEditorKitForContentType("text/html").createDefaultDocument();
    doc.setAsynchronousLoadPriority(-1);
    txt.setDocument(doc);
    URL url = I18.getResource("create_tap.html");
    try {
        txt.setPage(url);
    } catch (Exception ignored) {
    }
    txt.setEditable(false);
    content.add("North", new JScrollPane(txt));

    table = new YassTable();
    table.setEnabled(false);
    content.add("Center", scroll = new JScrollPane(table));
    content.add("South", check = new JCheckBox(I18.get("create_tap_edit")));
    check.setSelected(wizard.getValue("starteditor").equals("true"));
    check.addItemListener(
            new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    if (check.isSelected()) {
                        wizard.setValue("starteditor", "true");
                    } else {
                        wizard.setValue("starteditor", "false");
                    }
                }
            });
    scroll.setPreferredSize(new Dimension(100, 100));
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    return content;
}
项目:incubator-netbeans    文件:HibernateConfigurationWizardPanel.java   
/** Creates new form HibernateConfigurationWizardPanel */
public HibernateConfigurationWizardPanel() {
    initComponents();
    setDefaults();
    cmbDbConnection.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            changeSupport.fireChange();
        }

    });
}
项目:incubator-netbeans    文件:QueryParameter.java   
public ComboParameter(JComboBox combo, String parameter, String encoding) {
    super(parameter, encoding);
    this.combo = combo;
    combo.setModel(new DefaultComboBoxModel());
    combo.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            fireStateChanged();
        }
    });
    original = (ParameterValue) combo.getSelectedItem();
}
项目:openjdk-jdk10    文件:AbstractButtonOperator.java   
/**
 * Maps {@code AbstractButton.removeItemListener(ItemListener)} through queue
 */
public void removeItemListener(final ItemListener itemListener) {
    runMapping(new MapVoidAction("removeItemListener") {
        @Override
        public void map() {
            ((AbstractButton) getSource()).removeItemListener(itemListener);
        }
    });
}
项目:TwitchBot    文件:MainView.java   
public void setItemListener(ItemListener i) {
    this.actAsBot.addItemListener(i);
    this.trollMatti.addItemListener(i);
    this.trollPaul.addItemListener(i);
    this.logToFile.addItemListener(i);

}