Class MouseEventControl

java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.event.MouseEventControl
All Implemented Interfaces:
Savable, Control, JmeCloneable, Cloneable

public class MouseEventControl extends AbstractControl
A control that can be added to any Spatial to provide standard MouseListener/MouseEvent support. The only requirement is that the Spatial must be somewhere in a hierarchy that has been provided to the MouseAppState or GuiGlobals class and that MouseAppState is active (either manually attached to the StateManager or done automatically by GuiGlobals.initialize())
  • Constructor Details

    • MouseEventControl

      public MouseEventControl()
    • MouseEventControl

      public MouseEventControl(MouseListener... listeners)
  • Method Details

    • addListenersToSpatial

      public static void addListenersToSpatial(Spatial s, MouseListener... listeners)
      Convenience method that will add a MouseEventControl if it doesn't exist, while adding the specified listeners.
    • removeListenersFromSpatial

      public static void removeListenersFromSpatial(Spatial s, MouseListener... listeners)
      Convenience method that will remove the specified listeners from a Spatial only if a MouseEventControl already exists.
    • getMouseListener

      public <T extends MouseListener> T getMouseListener(Class<T> type)
    • isEmpty

      public boolean isEmpty()
    • addMouseListener

      public void addMouseListener(MouseListener l)
    • removeMouseListener

      public void removeMouseListener(MouseListener l)
    • mouseButtonEvent

      public void mouseButtonEvent(MouseButtonEvent event, Spatial target, Spatial capture)
    • mouseEntered

      public void mouseEntered(MouseMotionEvent event, Spatial target, Spatial capture)
    • mouseExited

      public void mouseExited(MouseMotionEvent event, Spatial target, Spatial capture)
    • mouseMoved

      public void mouseMoved(MouseMotionEvent event, Spatial target, Spatial capture)
    • controlRender

      protected void controlRender(RenderManager rm, ViewPort vp)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlRender in class AbstractControl
      Parameters:
      rm - the RenderManager rendering the controlled Spatial (not null)
      vp - the ViewPort being rendered (not null)
    • controlUpdate

      protected void controlUpdate(float tpf)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlUpdate in class AbstractControl
      Parameters:
      tpf - time per frame (in seconds)