List of usage examples for java.awt Component addMouseWheelListener
public synchronized void addMouseWheelListener(MouseWheelListener l)
From source file:Main.java
private static void addComponentListeners(Component c, Object... objs) { if (c == null) return;// ww w . j a v a 2s.co m ComponentListener componentListener = search(objs, ComponentListener.class); FocusListener focusListener = search(objs, FocusListener.class); HierarchyBoundsListener hierarchyBoundsListener = search(objs, HierarchyBoundsListener.class); HierarchyListener hierarchyListener = search(objs, HierarchyListener.class); InputMethodListener inputMethodListener = search(objs, InputMethodListener.class); KeyListener keyListener = search(objs, KeyListener.class); MouseListener mouseListener = search(objs, MouseListener.class); MouseMotionListener mouseMotionListener = search(objs, MouseMotionListener.class); MouseWheelListener mouseWheelListener = search(objs, MouseWheelListener.class); if (componentListener != null) c.addComponentListener(componentListener); if (focusListener != null) c.addFocusListener(focusListener); if (hierarchyBoundsListener != null) c.addHierarchyBoundsListener(hierarchyBoundsListener); if (hierarchyListener != null) c.addHierarchyListener(hierarchyListener); if (inputMethodListener != null) c.addInputMethodListener(inputMethodListener); if (keyListener != null) c.addKeyListener(keyListener); if (mouseListener != null) c.addMouseListener(mouseListener); if (mouseMotionListener != null) c.addMouseMotionListener(mouseMotionListener); if (mouseWheelListener != null) c.addMouseWheelListener(mouseWheelListener); }
From source file:Filter3dTest.java
/** * Creates a new InputManager that listens to input from the specified * component.//from ww w. java 2 s . co m */ public InputManager(Component comp) { this.comp = comp; mouseLocation = new Point(); centerLocation = new Point(); // register key and mouse listeners comp.addKeyListener(this); comp.addMouseListener(this); comp.addMouseMotionListener(this); comp.addMouseWheelListener(this); // allow input of the TAB key and other keys normally // used for focus traversal comp.setFocusTraversalKeysEnabled(false); }