Java Code Examples for javax.swing.AbstractButton#addChangeListener()

The following examples show how to use javax.swing.AbstractButton#addChangeListener() . 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: TransparentToolBar.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void addItem(JComponent c) {
    c.setOpaque(false);

    if (c instanceof JButton)
        ((JButton)c).setDefaultCapable(false);

    if (toolbar != null) {
        toolbar.add(c);
    } else {
        add(c);
        if (c instanceof AbstractButton) {
            AbstractButton b = (AbstractButton) c;
            b.addMouseListener(listener);
            b.addChangeListener(listener);
            b.addFocusListener(listener);
            b.setRolloverEnabled(true);
        }
    }
}
 
Example 2
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public void addItem(JComponent c) {
    c.setOpaque(false);

    if (c instanceof JButton)
        ((JButton)c).setDefaultCapable(false);

    if (toolbar != null) {
        toolbar.add(c);
    } else {
        add(c);
        if (c instanceof AbstractButton) {
            AbstractButton b = (AbstractButton) c;
            b.addMouseListener(listener);
            b.addChangeListener(listener);
            b.addFocusListener(listener);
            b.setRolloverEnabled(true);
        }
    }
}
 
Example 3
Source File: AbstractTopLevelController.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void registerClientPresenterListener(AbstractButton presenter) {
    presenter.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                updateClientPresentersEnabling(getClientPresenters());
            }
        });
}
 
Example 4
Source File: AbstractTopLevelController.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void registerClientPresenterListener(AbstractButton presenter) {
    presenter.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                updateClientPresentersEnabling(getClientPresenters());
            }
        });
}
 
Example 5
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public Component addItem(Component c, int index) {
    if (c instanceof JComponent)
        ((JComponent)c).setOpaque(false);

    if (c instanceof JButton)
        ((JButton)c).setDefaultCapable(false);
    
    if (UISupport.isAquaLookAndFeel() && c instanceof AbstractButton)
        ((AbstractButton)c).putClientProperty("JButton.buttonType", "gradient"); // NOI18N

    if (toolbar != null) {
        toolbar.add(c, index);
    } else {
        add(c, index);
        if (c instanceof AbstractButton) {
            AbstractButton b = (AbstractButton) c;
            b.addMouseListener(listener);
            b.addChangeListener(listener);
            b.addFocusListener(listener);
            b.setRolloverEnabled(true);
            listener.refresh(b);
        }
    }
    repaint();
    
    return c;
}