All Implemented Interfaces:
Control, View
Direct Known Subclasses:
AppView, ButtonView, GridView, InputView, ListView, MenuBarView, MenuView, ProgressView, StatusBarView

public class BoxView extends AbstractView
BoxView is a View with an empty background and optional border and title. All "boxed" views can use this as their base implementation by either subclassing or wrapping.
  • Constructor Details

    • BoxView

      public BoxView()
  • Method Details

    • setRect

      public void setRect(int x, int y, int width, int height)
      Description copied from interface: Control
      Sets bounds where this Control should operate.
      Specified by:
      setRect in interface Control
      Overrides:
      setRect in class AbstractControl
      Parameters:
      x - a x coord of a bounded box
      y - an y coord of a bounded box
      width - a width of a bounded box
      height - a height of a bounded box
    • setBorderPadding

      public BoxView setBorderPadding(int paddingTop, int paddingBottom, int paddingLeft, int paddingRight)
      Sets a paddings for this view.
      Parameters:
      paddingTop - the top padding
      paddingBottom - the bottom padding
      paddingLeft - the left padding
      paddingRight - the right padding
      Returns:
      a BoxView for chaining
    • setShowBorder

      public void setShowBorder(boolean showBorder)
      Defines if border is shown.
      Parameters:
      showBorder - the flag showing border
    • isShowBorder

      public boolean isShowBorder()
      Returns if border is shown.
      Returns:
      true if border is shown
    • setTitle

      public void setTitle(String title)
      Sets a title. title is shown within a top-level border boundary and will not be visible if border itself is not visible.
      Parameters:
      title - the border title
    • setBackgroundColor

      public void setBackgroundColor(int backgroundColor)
      Sets a background color. If color is set to null it indicates that background should be set to be empty causing possible layer to be non-transparent.
      Parameters:
      backgroundColor - the background color
    • setTitleColor

      public void setTitleColor(int titleColor)
      Sets a title color.
      Parameters:
      titleColor - the title color
    • setTitleStyle

      public void setTitleStyle(int titleStyle)
      Sets a title style.
      Parameters:
      titleStyle - the title style
    • setFocusedTitleColor

      public void setFocusedTitleColor(int focusedTitleColor)
      Sets a focused title color. Takes precedence set from setTitleColor(int).
      Parameters:
      focusedTitleColor - the title color
    • setFocusedTitleStyle

      public void setFocusedTitleStyle(int focusedTitleStyle)
      Sets a focused title style. Takes precedence set from setTitleStyle(int).
      Parameters:
      focusedTitleStyle - the title style
    • setTitleAlign

      public void setTitleAlign(HorizontalAlign titleAlign)
      Sets a title align.
      Parameters:
      titleAlign - the title align
    • getBackgroundStyle

      protected String getBackgroundStyle()
    • drawBackground

      protected void drawBackground(Screen screen)
      Description copied from class: AbstractView
      Internal drawing method for background.
      Overrides:
      drawBackground in class AbstractView
      Parameters:
      screen - the screen
    • drawInternal

      protected void drawInternal(Screen screen)
      Possibly draws a box around this view and title in a box top boundary. Also calls a draw function if defined.
      Specified by:
      drawInternal in class AbstractView
      Parameters:
      screen - the screen
    • getInnerRect

      protected Rectangle getInnerRect()
      Gets an inner rectangle of this view.
      Returns:
      an inner rectangle of this view