public void setInputSource(Component comp) { if (component != null) { component.removeMouseListener(this); component.removeMouseMotionListener(this); component.removeMouseWheelListener(this); eventQueue.clear(); wheelPos = 0; isRecentering = false; eventsSinceRecenter = 0; lastEventX = 0; lastEventY = 0; lastEventWheel = 0; location = new Point(); centerLocation = new Point(); centerLocationOnScreen = new Point(); lastKnownLocation = new Point(); } component = comp; component.addMouseListener(this); component.addMouseMotionListener(this); component.addMouseWheelListener(this); }
addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent event) { JScrollBar scrollBar = getScrollBar();
ex.printStackTrace(); addMouseWheelListener(new MouseAdapter() {
b.addMouseMotionListener(behavior); b.addMouseListener(behavior); b.addMouseWheelListener(behavior); JFrame f = new JFrame(); f.setLocation(10, 10);
model.setImplSpecificHelp(help); panel.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation();
addMouseWheelListener(new MouseAdapter() {
public void setOnMouseWheelMoved(JSObject aValue) { JSObject oldValue = getOnMouseWheelMoved(); handlers.put(mouseWheelMoved, aValue); if (mHandlee != null) { if (oldValue == null && aValue != null) { mHandlee.addMouseWheelListener(this); } else if (oldValue != null && aValue == null) { mHandlee.removeMouseWheelListener(this); } } }
@Override public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addMouseListener(this); awtComponent.addMouseMotionListener(this); awtComponent.addMouseWheelListener(this); return this; }
public void init() { _component.addMouseListener(this); _component.addMouseMotionListener(this); _component.addMouseWheelListener(this); }
public static void addMouseAdapter( Component c, MouseAdapter mouseAdapter ) { c.addMouseListener( mouseAdapter ); c.addMouseMotionListener( mouseAdapter ); c.addMouseWheelListener( mouseAdapter ); }
public void init() { _component.addMouseListener(this); _component.addMouseMotionListener(this); _component.addMouseWheelListener(this); }
void addToAll(Container c, MouseAdapter a) { for (Component p : c.getComponents()) { if (p instanceof InterrestingComponent) { p.addMouseListener(a); p.addMouseMotionListener(a); p.addMouseWheelListener(a); } else if (p instanceof Container) { addToAll((Container)p, a); } } }
public static void createMouseWheelListeners(ActionContext actionContext){ Thing self = (Thing) actionContext.get("self"); Component parent = (Component) actionContext.get("parent"); for(Thing child : self.getChilds()){ MouseWheelListener listener = (MouseWheelListener) child.doAction("create", actionContext); if(listener != null){ parent.addMouseWheelListener(listener); } } }
protected void addListeners(Component awt) { awt.addMouseListener(this); awt.addMouseMotionListener(this); awt.addMouseWheelListener(this); awt.addKeyListener(this); awt.addComponentListener(this); }
public static void addFontResizeOnScroll(Component scrollPane) { scrollPane.addMouseWheelListener(event -> { if (event.isMetaDown()) { final int unitsToScroll = -event.getUnitsToScroll(); changeFontSize(getDeepestComponent(scrollPane, event.getPoint()), unitsToScroll); } }); }
public void install(NavigableMap2D map) { installed = true; map2D = map; map2D.addDecoration(zoompanPanel); map2D.getComponent().addMouseListener(mouseInputListener); map2D.getComponent().addMouseMotionListener(mouseInputListener); map2D.getComponent().addMouseWheelListener(mouseInputListener); }
public void install(NavigableMap2D map) { installed = true; map2D = map; map2D.addDecoration(zoompanPanel); map2D.getComponent().addMouseListener(mouseInputListener); map2D.getComponent().addMouseMotionListener(mouseInputListener); map2D.getComponent().addMouseWheelListener(mouseInputListener); }
public void install(NavigableMap2D map) { installed = true; map2D = map; map2D.addDecoration(zoompanPanel); map2D.getComponent().addMouseListener(mouseInputListener); map2D.getComponent().addMouseMotionListener(mouseInputListener); map2D.getComponent().addMouseWheelListener(mouseInputListener); }
/** * Creates a new event converter, that converts swing events to go events. * * @param component * The component. * @param provider * THe provider to which to send the events. */ public GOSwingEventConverter(Component component, GOEventHandlerProvider provider) { super(provider); component.setFocusTraversalKeysEnabled(false); component.addKeyListener(this); component.addMouseListener(this); component.addMouseMotionListener(this); component.addMouseWheelListener(this); component.addHierarchyListener(this); addReplaceRule(new EventReplacementRule(ReplacableEvent.DRAW, Replacement.COMMAND_SELECT, MOUSE_TIME_TRSHOLD, MOUSE_MOVE_TRESHOLD)); addReplaceRule(new EventReplacementRule(ReplacableEvent.PAN, Replacement.COMMAND_ACTION, MOUSE_TIME_TRSHOLD, MOUSE_MOVE_TRESHOLD)); }
public void startCore(Application application) { //Setup first Application application.setSession(session); this.window.setApplication(application); reload(application); component.setFocusTraversalKeysEnabled(false); component.setFocusable(true); component.requestFocus(); hideDefaultCursor(component); // Define Listeners component.addMouseMotionListener(getMouse()); component.addMouseWheelListener(getMouse()); component.addMouseListener(getMouse()); component.addKeyListener((AWTKeyboard) getKeyboard()); }