/** * This method installs mouse and key listeners on the canvas that forward * those events to piccolo. */ protected void installInputSources() { if (mouseListener == null) { mouseListener = new MouseEventInputSource(); addMouseListener(mouseListener); } if (mouseMotionListener == null) { mouseMotionListener = new MouseMotionInputSourceListener(); addMouseMotionListener(mouseMotionListener); } if (mouseWheelListener == null) { mouseWheelListener = new MouseWheelInputSourceListener(); addMouseWheelListener(mouseWheelListener); } if (keyEventPostProcessor == null) { keyEventPostProcessor = new KeyEventInputSourceListener(); KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(keyEventPostProcessor); } }