Search in sources :

Example 91 with ItemListener

use of java.awt.event.ItemListener in project OpenNotebook by jaltekruse.

the class BooleanAdjustmentPanel method addPanelContent.

@Override
public void addPanelContent() {
    setLayout(new GridLayout(0, 1));
    checkbox = new JCheckBox(mAtt.getName());
    checkbox.setSelected(mAtt.getValue());
    checkbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                mAtt.setValue(true);
                if (notebookPanel != null) {
                    notebookPanel.getCurrentDocViewer().repaintDoc();
                    notebookPanel.getCurrentDocViewer().addUndoState();
                    notebookPanel.getCurrentDocViewer().updateObjectToolFrame();
                }
            } else {
                mAtt.setValue(false);
                if (notebookPanel != null) {
                    notebookPanel.getCurrentDocViewer().repaintDoc();
                    notebookPanel.getCurrentDocViewer().addUndoState();
                    notebookPanel.getCurrentDocViewer().updateObjectToolFrame();
                }
            }
        }
    });
    add(checkbox);
}
Also used : JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 92 with ItemListener

use of java.awt.event.ItemListener in project jadx by skylot.

the class SearchDialog method makeOptionsCheckBox.

private JCheckBox makeOptionsCheckBox(String name, final SearchOptions opt) {
    final JCheckBox chBox = new JCheckBox(name);
    chBox.setAlignmentX(LEFT_ALIGNMENT);
    chBox.setSelected(options.contains(opt));
    chBox.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (chBox.isSelected()) {
                options.add(opt);
            } else {
                options.remove(opt);
            }
            performSearch();
        }
    });
    return chBox;
}
Also used : JCheckBox(javax.swing.JCheckBox) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 93 with ItemListener

use of java.awt.event.ItemListener in project jadx by skylot.

the class JadxSettingsWindow method makeOtherGroup.

private SettingsGroup makeOtherGroup() {
    JCheckBox update = new JCheckBox();
    update.setSelected(settings.isCheckForUpdates());
    update.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setCheckForUpdates(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    JCheckBox cfg = new JCheckBox();
    cfg.setSelected(settings.isCFGOutput());
    cfg.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setCfgOutput(e.getStateChange() == ItemEvent.SELECTED);
            needReload();
        }
    });
    JCheckBox rawCfg = new JCheckBox();
    rawCfg.setSelected(settings.isRawCFGOutput());
    rawCfg.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setRawCfgOutput(e.getStateChange() == ItemEvent.SELECTED);
            needReload();
        }
    });
    SettingsGroup other = new SettingsGroup(NLS.str("preferences.other"));
    other.addRow(NLS.str("preferences.check_for_updates"), update);
    other.addRow(NLS.str("preferences.cfg"), cfg);
    other.addRow(NLS.str("preferences.raw_cfg"), rawCfg);
    return other;
}
Also used : JCheckBox(javax.swing.JCheckBox) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 94 with ItemListener

use of java.awt.event.ItemListener in project jadx by skylot.

the class JadxSettingsWindow method makeDeobfuscationGroup.

private SettingsGroup makeDeobfuscationGroup() {
    JCheckBox deobfOn = new JCheckBox();
    deobfOn.setSelected(settings.isDeobfuscationOn());
    deobfOn.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setDeobfuscationOn(e.getStateChange() == ItemEvent.SELECTED);
            needReload();
        }
    });
    JCheckBox deobfForce = new JCheckBox();
    deobfForce.setSelected(settings.isDeobfuscationForceSave());
    deobfForce.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setDeobfuscationForceSave(e.getStateChange() == ItemEvent.SELECTED);
            needReload();
        }
    });
    final JSpinner minLen = new JSpinner();
    minLen.setValue(settings.getDeobfuscationMinLength());
    minLen.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            settings.setDeobfuscationMinLength((Integer) minLen.getValue());
            needReload();
        }
    });
    final JSpinner maxLen = new JSpinner();
    maxLen.setValue(settings.getDeobfuscationMaxLength());
    maxLen.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            settings.setDeobfuscationMaxLength((Integer) maxLen.getValue());
            needReload();
        }
    });
    JCheckBox deobfSourceAlias = new JCheckBox();
    deobfSourceAlias.setSelected(settings.useSourceNameAsClassAlias());
    deobfSourceAlias.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            settings.setUseSourceNameAsClassAlias(e.getStateChange() == ItemEvent.SELECTED);
            needReload();
        }
    });
    SettingsGroup deobfGroup = new SettingsGroup(NLS.str("preferences.deobfuscation"));
    deobfGroup.addRow(NLS.str("preferences.deobfuscation_on"), deobfOn);
    deobfGroup.addRow(NLS.str("preferences.deobfuscation_force"), deobfForce);
    deobfGroup.addRow(NLS.str("preferences.deobfuscation_min_len"), minLen);
    deobfGroup.addRow(NLS.str("preferences.deobfuscation_max_len"), maxLen);
    deobfGroup.addRow(NLS.str("preferences.deobfuscation_source_alias"), deobfSourceAlias);
    deobfGroup.end();
    return deobfGroup;
}
Also used : JCheckBox(javax.swing.JCheckBox) ItemEvent(java.awt.event.ItemEvent) ChangeEvent(javax.swing.event.ChangeEvent) JSpinner(javax.swing.JSpinner) ItemListener(java.awt.event.ItemListener) ChangeListener(javax.swing.event.ChangeListener)

Example 95 with ItemListener

use of java.awt.event.ItemListener in project android by JetBrains.

the class TwoRadiosToBooleanBinding method addActionListener.

@Override
public void addActionListener(@NotNull final ActionListener listener, @NotNull final JPanel component) {
    ItemListener itemListener = (ItemEvent e) -> {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            String actionCommand = ((JRadioButton) e.getItem()).getActionCommand();
            ActionEvent event = new ActionEvent(component, e.getID(), actionCommand);
            listener.actionPerformed(event);
        }
    };
    myButtonTrue.addItemListener(itemListener);
    myButtonFalse.addItemListener(itemListener);
}
Also used : ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener)

Aggregations

ItemListener (java.awt.event.ItemListener)162 ItemEvent (java.awt.event.ItemEvent)154 ActionEvent (java.awt.event.ActionEvent)45 ActionListener (java.awt.event.ActionListener)43 JCheckBox (javax.swing.JCheckBox)33 JPanel (javax.swing.JPanel)27 JLabel (javax.swing.JLabel)23 JComboBox (javax.swing.JComboBox)18 BoxLayout (javax.swing.BoxLayout)15 JTextField (javax.swing.JTextField)14 DocumentEvent (javax.swing.event.DocumentEvent)13 JButton (javax.swing.JButton)12 ChangeEvent (javax.swing.event.ChangeEvent)12 Dimension (java.awt.Dimension)11 ChangeListener (javax.swing.event.ChangeListener)11 GridBagConstraints (java.awt.GridBagConstraints)10 GridLayout (java.awt.GridLayout)10 Box (javax.swing.Box)10 GridBagLayout (java.awt.GridBagLayout)9 BorderLayout (java.awt.BorderLayout)8