javax.swing.AbstractButton#addMouseListener ( )源码实例Demo

下面列出了javax.swing.AbstractButton#addMouseListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: TransparentToolBar.java
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);
        }
    }
}
 
源代码2 项目: visualvm   文件: TransparentToolBar.java
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);
        }
    }
}
 
源代码3 项目: netbeans   文件: NbEditorToolBar.java
private void processButton(AbstractButton button) {
    removeButtonContentAreaAndBorder(button);
    button.setMargin(BUTTON_INSETS);
    if (button instanceof AbstractButton) {
        button.addMouseListener(sharedMouseListener);
    }
    //fix of issue #69642. Focus shouldn't stay in toolbar
    button.setFocusable(false);
}
 
源代码4 项目: netbeans   文件: DataViewUI.java
private void processButton(AbstractButton button) {
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setMargin(BUTTON_INSETS);
    if (button instanceof AbstractButton) {
        button.addMouseListener(sharedMouseListener);
    }
    //Focus shouldn't stay in toolbar
    button.setFocusable(false);
}
 
源代码5 项目: visualvm   文件: TransparentToolBar.java
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;
}
 
源代码6 项目: WorldGrower   文件: JButtonFactory.java
private static void addClickSoundEffect(SoundIdReader soundIdReader, AbstractButton button) {
	if (soundIdReader == null) {
		throw new IllegalStateException("soundIdReader is null");
	}
	
	button.addMouseListener(new MouseAdapter() {
		@Override
           public void mousePressed(MouseEvent e) {
           	soundIdReader.playSoundEffect(SoundIds.CLICK);
           }
       });
}
 
源代码7 项目: snap-desktop   文件: ToolButtonFactory.java
private static void configure(AbstractButton button) {

        RolloverButtonEventListener l = new RolloverButtonEventListener();
        button.addMouseListener(l);
        button.addItemListener(l);

        if (button.getAction() != null) {
            if (button.getIcon() != null) {
                button.putClientProperty("hideActionText", Boolean.TRUE);
            }
            Object largeIcon = button.getAction().getValue("_largeIcon");
            if (largeIcon instanceof Icon) {
                button.setIcon((Icon) largeIcon);
            }
        }

        Icon icon = button.getIcon();
        int minWidth = BUTTON_MIN_SIZE;
        int minHeight = BUTTON_MIN_SIZE;
        if (icon != null) {
            button.setText(null);
            minWidth = Math.max(icon.getIconWidth(), BUTTON_MIN_SIZE);
            minHeight = Math.max(icon.getIconHeight(), BUTTON_MIN_SIZE);
            if (icon instanceof ImageIcon) {
                button.setRolloverIcon(createRolloverIcon((ImageIcon) icon));
            }
        } else {
            button.setText("[?]");
        }
        final int space = 3;
        Dimension prefSize = new Dimension(minWidth + space, minHeight + space);
        Dimension minSize = new Dimension(minWidth, minHeight);
        Dimension maxSize = new Dimension(minWidth + space, minHeight + space);
        button.setPreferredSize(prefSize);
        button.setMaximumSize(maxSize);
        button.setMinimumSize(minSize);

    }
 
源代码8 项目: netbeans   文件: SlideGestureRecognizer.java
/** Attaches given button to this recognizer, it means starts listening
 * on its various mouse and action events
 */
public void attachButton (AbstractButton button) {
    button.addActionListener(this);
    button.addMouseListener(this);
    button.addMouseMotionListener(this);
}
 
源代码9 项目: netbeans   文件: SearchButton.java
private static void processButton(AbstractButton button) {
    removeButtonContentAreaAndBorder(button);
    button.setMargin(BUTTON_INSETS);
    button.addMouseListener(sharedMouseListener);
    button.setFocusable(false);
}
 
源代码10 项目: orbit-image-analysis   文件: BasicLinkButtonUI.java
protected void installListeners(AbstractButton b) {
  super.installListeners(b);
  b.addMouseListener(handCursorListener);
}
 
源代码11 项目: ccu-historian   文件: FloatingButtonEnabler.java
/**
 * Adds a button to this enabler.
 *
 * @param button  the button.
 */
public void addButton(final AbstractButton button) {
    button.addMouseListener(this);
    button.setBorderPainted(false);
}
 
源代码12 项目: ccu-historian   文件: FloatingButtonEnabler.java
/**
 * Removes a button from the enabler.
 *
 * @param button  the button.
 */
public void removeButton(final AbstractButton button) {
    button.addMouseListener(this);
    button.setBorderPainted(true);
}