Class GuiControl

All Implemented Interfaces:
Savable, Control, JmeCloneable, FocusTarget, FocusTraversal, Cloneable

public class GuiControl extends AbstractNodeControl<GuiControl> implements FocusTarget, FocusTraversal
Manages a component stack, the parent/child relationship, and other standard GuiControl functionality.
  • Constructor Details

    • GuiControl

      public GuiControl(GuiComponent... components)
    • GuiControl

      public GuiControl(String... layerOrder)
  • Method Details

    • getNode

      public Node getNode()
      Overrides:
      getNode in class AbstractNodeControl<GuiControl>
    • addListener

      public void addListener(GuiControlListener l)
    • removeListener

      public void removeListener(GuiControlListener l)
    • addFocusChangeListener

      public void addFocusChangeListener(FocusChangeListener l)
    • removeFocusChangeListener

      public void removeFocusChangeListener(FocusChangeListener l)
    • addUpdateListener

      public void addUpdateListener(GuiUpdateListener l)
    • removeUpdateListener

      public void removeUpdateListener(GuiUpdateListener l)
    • isFocused

      public boolean isFocused()
      Description copied from interface: FocusTarget
      Returns true if this focus target currently has the focus.
      Specified by:
      isFocused in interface FocusTarget
    • setFocusable

      public void setFocusable(boolean b)
      Sets the focusable state to true for this control even if none of the child components are focusable.
    • isFocusable

      public boolean isFocusable()
      Returns true if this control is focusable, either because one of its child components/layout is focusable or because setFocusable(true) was called.
      Specified by:
      isFocusable in interface FocusTarget
    • focusGained

      public void focusGained()
      Description copied from interface: FocusTarget
      Notifies this focus target that is has gained focus.
      Specified by:
      focusGained in interface FocusTarget
    • focusLost

      public void focusLost()
      Description copied from interface: FocusTarget
      Notifies this focus target that is has lost focus.
      Specified by:
      focusLost in interface FocusTarget
    • getDefaultFocus

      public Spatial getDefaultFocus()
      Description copied from interface: FocusTraversal
      Returns the focusable element that should receive focus when first entering this container level.
      Specified by:
      getDefaultFocus in interface FocusTraversal
    • getRelativeFocus

      public Spatial getRelativeFocus(Spatial from, FocusTraversal.TraversalDirection direction)
      Description copied from interface: FocusTraversal
      Returns the relative focusable element from the specified element in the specified direction as defined by this focus container's implementation of that direction's policy.
      Specified by:
      getRelativeFocus in interface FocusTraversal
    • isFocusRoot

      public boolean isFocusRoot()
      Description copied from interface: FocusTraversal
      Returns true if this is the root of a focus container hierarchy and navigation should not be permitted out of the container. This is commonly used for root-level windows are any container where the user must initiate a specific action to change contexts.
      Specified by:
      isFocusRoot in interface FocusTraversal
    • setLayerOrder

      public void setLayerOrder(String... layers)
    • setLayout

      public void setLayout(GuiLayout l)
    • getLayout

      public <T extends GuiLayout> T getLayout()
    • setPreferredSize

      public void setPreferredSize(Vector3f pref)
    • getPreferredSize

      public Vector3f getPreferredSize()
    • setSize

      public void setSize(Vector3f size)
    • getSize

      public Vector3f getSize()
    • getComponents

      public List<GuiComponent> getComponents()
    • addComponent

      public <T extends GuiComponent> T addComponent(T c)
    • getComponentIndex

      public int getComponentIndex(GuiComponent c)
    • setComponent

      public <T extends GuiComponent> T setComponent(String key, T component)
      Sets a new component to the specified layer and returns THAT component, not the previous value. This is so that it works like addComponent() in that you can set it and grab it at the same time.
    • getComponent

      public <T extends GuiComponent> T getComponent(String key)
    • removeComponent

      public <T extends GuiComponent> T removeComponent(String key)
    • removeComponent

      public boolean removeComponent(GuiComponent c)
    • attach

      protected void attach()
      Specified by:
      attach in class AbstractNodeControl<GuiControl>
    • controlUpdate

      protected void controlUpdate(float tpf)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Overrides:
      controlUpdate in class AbstractNodeControl<GuiControl>
      Parameters:
      tpf - time per frame (in seconds)
    • hasParent

      protected boolean hasParent()
    • isChild

      protected boolean isChild()
    • revalidate

      protected void revalidate()
    • invalidate

      public void invalidate()
    • detach

      protected void detach()
      Specified by:
      detach in class AbstractNodeControl<GuiControl>