java.lang.Object
it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
Direct Known Subclasses:
WindowItem

public abstract class Rectangle
extends java.lang.Object
More than just a rectangle
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Color color
    The rectangle color scheme
    protected int height
    The rectangle height
    protected CursorPosition initCoord
    The position to start drawing the rectangle from
    protected java.util.Properties properties
    The object properties
    protected int width
    The rectangle width
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected Rectangle()
    Default constructor
    Creates a new Rectangle object, loading the settings from a file
    protected Rectangle​(CursorPosition initCoord, int width, int height)
    Custom constructor
    Creates a new Rectangle object, using the given parameters
  • Method Summary

    Modifier and Type Method Description
    protected void drawBackground()
    Draws the rectangle on the screen
    protected void drawBorders()
    Draws black and white borders
    protected void drawShadows()
    Draws right and bottom shadows
    protected static int findCenter​(int containerSize, int itemSize)
    Finds the index to start from to center an item into a container
    java.lang.String getBackgroundColor()
    backgroundColor getter
    Color getColor()
    color getter
    int getHeight()
    height getter
    CursorPosition getInitCoord()
    initCoord getter
    java.lang.String getTextColor()
    textColor getter
    int getWidth()
    width getter
    protected void hideBorders()
    Hides the borders
    protected void hideShadows()
    Hides the shadows
    protected void loadPropertiesFile()
    Loads the properties file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • height

      protected final int height
      The rectangle height
    • width

      protected final int width
      The rectangle width
    • color

      protected final Color color
      The rectangle color scheme
    • initCoord

      protected final CursorPosition initCoord
      The position to start drawing the rectangle from
    • properties

      protected final java.util.Properties properties
      The object properties
  • Constructor Details

    • Rectangle

      protected Rectangle()
      Default constructor
      Creates a new Rectangle object, loading the settings from a file
    • Rectangle

      protected Rectangle​(CursorPosition initCoord, int width, int height)
      Custom constructor
      Creates a new Rectangle object, using the given parameters
      Parameters:
      width - the object width
      height - the object height
      initCoord - the object initial coordinates
  • Method Details

    • findCenter

      protected static int findCenter​(int containerSize, int itemSize)
      Finds the index to start from to center an item into a container
      Parameters:
      containerSize - the container size
      itemSize - the item size
      Returns:
      the coordinate to center the item in the container
    • loadPropertiesFile

      protected void loadPropertiesFile()
      Loads the properties file
    • getHeight

      public int getHeight()
      height getter
      Returns:
      the rectangle height
    • getWidth

      public int getWidth()
      width getter
      Returns:
      the rectangle width
    • getColor

      public Color getColor()
      color getter
      Returns:
      the rectangle colors config
    • getInitCoord

      public CursorPosition getInitCoord()
      initCoord getter
      Returns:
      the rectangle initial coordinates
    • getBackgroundColor

      public java.lang.String getBackgroundColor()
      backgroundColor getter
      Returns:
      the rectangle dark color scheme
    • getTextColor

      public java.lang.String getTextColor()
      textColor getter
      Returns:
      the color of the text to be printed on this
    • drawBackground

      protected void drawBackground()
      Draws the rectangle on the screen
    • drawBorders

      protected void drawBorders()
      Draws black and white borders
    • hideBorders

      protected void hideBorders()
      Hides the borders
    • drawShadows

      protected void drawShadows()
      Draws right and bottom shadows
    • hideShadows

      protected void hideShadows()
      Hides the shadows