Class UIFrame

All Implemented Interfaces:
UIKeyHandler, Hintable, Savable

public class UIFrame extends UIContainer
A component similar to an inner frame in Swing. It can be dragged around the screen, minimized, expanded, closed, and resized. Frames can also have their opacity individually assigned which will affect all elements drawn within them.
  • Constructor Details

    • UIFrame

      public UIFrame(String title)
      Construct a new UIFrame with the given title and default buttons (CLOSE).
      Parameters:
      title - the text to display on the title bar of this frame
    • UIFrame

      public UIFrame(String title, EnumSet<UIFrame.FrameButtons> buttons)
      Construct a new UIFrame with the given title and button.
      Parameters:
      title - the text to display on the title bar of this frame
      buttons - which buttons we should show in the frame bar.
  • Method Details

    • setDecorated

      public void setDecorated(boolean decorated)
      Parameters:
      decorated - true to show the title and status bars. False to remove both. Undecorated frames have no resize or drag handles, or close buttons, etc.
    • maximize

      public void maximize()
    • restore

      public void restore()
    • isDecorated

      public boolean isDecorated()
      Returns:
      true if this frame is decorated.
    • setResizeable

      public void setResizeable(boolean resizeable)
      Parameters:
      resizeable - true if we should allow resizing of this frame via a resize handle in the status bar. This does not stop programmatic resizing of this frame.
    • isResizeable

      public boolean isResizeable()
      Returns:
      true if this frame allows manual resizing.
    • setDraggable

      public void setDraggable(boolean draggable)
      Parameters:
      draggable - true if we should allow dragging of this frame via a frame bar.
    • isDraggable

      public boolean isDraggable()
      Returns:
      true if this frame allows dragging.
    • close

      public void close()
      Remove this frame from the hud it is attached to.
      Throws:
      IllegalStateException - if frame is not currently attached to a hud.
    • getTitleBar

      public UIFrameBar getTitleBar()
      Returns:
      this frame's title bar
    • getStatusBar

      public UIFrameStatusBar getStatusBar()
      Returns:
      this frame's status bar
    • getContentPanel

      public UIPanel getContentPanel()
      Returns:
      the center content panel of this frame.
    • getBasePanel

      public UIPanel getBasePanel()
      Returns:
      the base panel of this frame which holds the content panel and status bar.
    • setContentPanel

      public void setContentPanel(UIPanel panel)
      Replaces the content panel of this frame with a new one.
      Parameters:
      panel - the new content panel.
    • getTitle

      public String getTitle()
      Returns:
      the current title of this frame
    • setTitle

      public void setTitle(String title)
      Sets the title of this frame
      Parameters:
      title - the new title
    • attachedToHud

      public void attachedToHud()
      Description copied from class: UIComponent
      Override to provide an action to take when this component or its top level component are attached to a UIHud.
      Overrides:
      attachedToHud in class UIContainer
    • detachedFromHud

      public void detachedFromHud()
      Description copied from class: UIComponent
      Override to provide an action to take just before this component or its top level component are removed from a UIHud.
      Overrides:
      detachedFromHud in class UIContainer
    • pack

      public void pack()
      Description copied from class: UIComponent
      Resize the container to fit the minimum size of its content panel.
      Overrides:
      pack in class UIComponent
    • resetTextureRenderer

      public static void resetTextureRenderer(Object queueKey)
      Causes our shared texture renderer - used to draw cached versions of all frames - to be recreated on the next render loop.
      Parameters:
      queueKey - the queue key
    • findParentFrame

      public static UIFrame findParentFrame(UIComponent component)
      Recursive convenience method for locating the first UIFrame above a given component.
      Parameters:
      component - the component to look above.
      Returns:
      the first UIFrame found above the given component, or null if none.
    • setDragListener

      public void setDragListener(DragListener listener)
      Set a new drag listener on this frame.
      Parameters:
      listener - the drag listener. Must not be null.
    • isMaximized

      public boolean isMaximized()