Java Code Examples for javax.swing.JComponent#removeMouseListener()

The following examples show how to use javax.swing.JComponent#removeMouseListener() . 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: ToolTipManagerEx.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
    * Registers a component for tooltip management.
    * <p>
    * This will register key bindings to show and hide the tooltip text
    * only if <code>component</code> has focus bindings. This is done
    * so that components that are not normally focus traversable, such
    * as <code>JLabel</code>, are not made focus traversable as a result
    * of invoking this method.
    *
    * @param component  a <code>JComponent</code> object to add
    * @see JComponent#isFocusTraversable
    */
   protected void registerComponent(JComponent component) {
       component.removeMouseListener(this);
       component.addMouseListener(this);
       component.removeMouseMotionListener(moveBeforeEnterListener);
component.addMouseMotionListener(moveBeforeEnterListener);

if (shouldRegisterBindings(component)) {
    // register our accessibility keybindings for this component
    // this will apply globally across L&F
    // Post Tip: Ctrl+F1
    // Unpost Tip: Esc and Ctrl+F1
    InputMap inputMap = component.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap actionMap = component.getActionMap();

    if (inputMap != null && actionMap != null) {
               //XXX remove
    }
}
   }
 
Example 2
Source File: Rubber.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Actually register the rubber as the mouse listener for the provided component.
 *
 * @param component the related component
 */
public final void connectComponent (JComponent component)
{
    // Clean up if needed
    disconnectComponent(this.component);

    // Remember the related component (to get visible rect, etc ...)
    this.component = component;

    if (component != null) {
        // To be notified of mouse clicks
        component.removeMouseListener(this); // No multiple notifications
        component.addMouseListener(this);

        // To be notified of mouse mouvements
        component.removeMouseMotionListener(this); // No multiple notifs
        component.addMouseMotionListener(this);

        // To be notified of mouse  wheel mouvements
        component.removeMouseWheelListener(this); // No multiple notifs
        component.addMouseWheelListener(this);
    }
}
 
Example 3
Source File: Rubber.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Actually register the rubber as the mouse listener for the provided
 * component.
 *
 * @param component the related component
 */
public void connectComponent (JComponent component)
{
    // Clean up if needed
    disconnectComponent(this.component);

    // Remember the related component (to get visible rect, etc ...)
    this.component = component;

    // To be notified of mouse clicks
    component.removeMouseListener(this); // No multiple notifications
    component.addMouseListener(this);

    // To be notified of mouse mouvements
    component.removeMouseMotionListener(this); // No multiple notifs
    component.addMouseMotionListener(this);

    // To be notified of mouse  wheel mouvements
    component.removeMouseWheelListener(this); // No multiple notifs
    component.addMouseWheelListener(this);
}
 
Example 4
Source File: LuckComboBoxUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
/**
 * remove focus Listener
 *
 * @param c
 */
protected void uninstallFocusListener(JComponent c)
{
    if(handle != null)
    {
        c.removeMouseListener(handle);

        c.removeFocusListener(handle);

        handle = null;
    }
}
 
Example 5
Source File: LuckFormattedTextFieldUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
/**
 * remove focus Listener
 *
 * @param c
 */
protected void uninstallFocusListener(JComponent c)
{
    if(handle != null)
    {
        c.removeMouseListener(handle);

        c.removeFocusListener(handle);

        handle = null;
    }
    
    borderShape = null;
}
 
Example 6
Source File: LuckPasswordFieldUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
/**
 * remove focus Listener
 *
 * @param c
 */
protected void uninstallFocusListener(JComponent c)
{
    if(handle != null)
    {
        c.removeMouseListener(handle);

        c.removeFocusListener(handle);

        handle = null;
    }
    
    borderShape = null;
}
 
Example 7
Source File: BreadCrumbUI.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public void uninstallUI(JComponent c) {
	super.uninstallUI(c);

	c.removeMouseListener(mouseListener);
	c.removePropertyChangeListener(JBreadCrumb.PATH_KEY, refreshUIListener);
	c.removePropertyChangeListener(JBreadCrumb.FORMATTER_KEY,
			refreshUIListener);
	c.removePropertyChangeListener(PROPERTY_SEPARATOR_ICON,
			refreshUIListener);
}
 
Example 8
Source File: Rubber.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Disconnect the provided component
 *
 * @param component the component to disconnect
 */
public void disconnectComponent (JComponent component)
{
    if (component != null) {
        component.removeMouseListener(this);
        component.removeMouseMotionListener(this);
        component.removeMouseWheelListener(this);
    }
}
 
Example 9
Source File: MultiThumbSliderUI.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public void uninstallUI(JComponent slider) {
	slider.removeMouseListener(this);
	slider.removeMouseMotionListener(this);
	slider.removeFocusListener(focusListener);
	slider.removeKeyListener(keyListener);
	slider.removeComponentListener(compListener);
	slider.removePropertyChangeListener(propertyListener);
	slider.removePropertyChangeListener(THUMB_SHAPE_PROPERTY,
			thumbShapeListener);
	super.uninstallUI(slider);
}
 
Example 10
Source File: SwingRendererImpl.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Free all allocated system resources.
 */
@Override
public void dispose( )
{
	super.dispose( );
	
	_lhmAllTriggers.clear( );

	if ( _iun != null )
	{
		Object obj = _iun.peerInstance( );

		if ( obj instanceof JComponent )
		{
			JComponent jc = (JComponent) obj;

			if ( _eh != null )
			{
				jc.removeMouseListener( _eh );
				jc.removeMouseMotionListener( _eh );
				jc.removeKeyListener( _eh );
				jc.removeFocusListener( _eh );

				_eh = null;
			}
		}
	}
}
 
Example 11
Source File: WritingTextArea.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
public void uninstallUI(JComponent c) {
	super.uninstallUI(c);
	c.removeKeyListener(keyListener);
	c.removeMouseListener(mouseListener);
	layout.removePropertyChangeListener(layoutListener);
}
 
Example 12
Source File: Rubber.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Disconnect the provided component
 *
 * @param component the component to disconnect
 */
private void disconnectComponent (JComponent component)
{
    if (component != null) {
        component.removeMouseListener(this);
        component.removeMouseMotionListener(this);
        component.removeMouseWheelListener(this);
    }
}
 
Example 13
Source File: RocLinePanel.java    From rtg-tools with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void insertRightMouseButtonFilter(final JComponent component) {
  final RightMouseButtonFilter filter = new RightMouseButtonFilter(component.getMouseListeners());
  for (final MouseListener l : filter.mListeners) {
    component.removeMouseListener(l);
  }
  component.addMouseListener(filter);
}
 
Example 14
Source File: ToolTipManagerEx.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
    * Removes a component from tooltip control.
    *
    * @param component  a <code>JComponent</code> object to remove
    */
   protected void unregisterComponent(JComponent component) {
       component.removeMouseListener(this);
component.removeMouseMotionListener(moveBeforeEnterListener);

if (shouldRegisterBindings(component)) {
    InputMap inputMap = component.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap actionMap = component.getActionMap();

    if (inputMap != null && actionMap != null) {
               //XXX remove
    }
}
   }
 
Example 15
Source File: MultiThumbSliderUI.java    From PyramidShader with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void uninstallUI(JComponent slider) {
	slider.removeMouseListener(this);
	slider.removeMouseMotionListener(this);
	slider.removeFocusListener(focusListener);
	slider.removeKeyListener(keyListener);
	slider.removeComponentListener(compListener);
	slider.removePropertyChangeListener(propertyListener);
	slider.removePropertyChangeListener(THUMB_SHAPE_PROPERTY, thumbShapeListener);
	super.uninstallUI(slider);
}
 
Example 16
Source File: CodeBrowserPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void addMarginProvider(MarginProvider marginProvider) {
	JComponent component = marginProvider.getComponent();

	// just in case we get repeated calls
	component.removeMouseListener(focusingMouseListener);
	component.addMouseListener(focusingMouseListener);
	connectedProvider.getListingPanel().addMarginProvider(marginProvider);
}
 
Example 17
Source File: CodeBrowserPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void addOverviewProvider(OverviewProvider overviewProvider) {
	JComponent component = overviewProvider.getComponent();

	// just in case we get repeated calls
	component.removeMouseListener(focusingMouseListener);
	component.addMouseListener(focusingMouseListener);
	connectedProvider.getListingPanel().addOverviewProvider(overviewProvider);
}
 
Example 18
Source File: ComponentToolTipManager.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Removes a component from tooltip control.
 * 
 * @param component a <code>JComponent</code> object to remove
 */
public void unregisterComponent(JComponent component) {
  component.removeMouseListener(this);
  component.removeMouseMotionListener(moveBeforeEnterListener);

}
 
Example 19
Source File: ComponentToolTipManager.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Removes a component from tooltip control.
 * 
 * @param component a <code>JComponent</code> object to remove
 */
public void unregisterComponent(JComponent component) {
  component.removeMouseListener(this);
  component.removeMouseMotionListener(moveBeforeEnterListener);

}
 
Example 20
Source File: CodeBrowserPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public void removeMarginProvider(MarginProvider marginProvider) {
	JComponent component = marginProvider.getComponent();
	component.removeMouseListener(focusingMouseListener);
	connectedProvider.getListingPanel().removeMarginProvider(marginProvider);
}