public void attachTo(@Nullable Component owner, @Nullable Component mouseTarget) { if (myMouseTarget != null) { myClickListener.uninstall(myMouseTarget); myMouseTarget.removeMouseMotionListener(myMouseMotionListener); } myOwner = owner; myMouseTarget = mouseTarget; if (myMouseTarget != null) { myClickListener.installOn(myMouseTarget); myMouseTarget.addMouseMotionListener(myMouseMotionListener); } }
/** * Remove listeners from the specified component * * @param component the component the listeners are removed from */ public void deregisterComponent(Component... components) { for (Component component : components) { component.removeMouseListener(this); component.removeMouseMotionListener(this); } }