void () { myComponent.addMouseListener(new MyMouseListener()); myComponent.addMouseMotionListener(new MyMouseMotionListener()); myComponent.addKeyListener(new PressedKeyListener()); myComponent.addFocusListener(new ButtonFocusListener()); setActionTrigger(MouseEvent.MOUSE_RELEASED); }