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 schemeprotected int
height
The rectangle heightprotected CursorPosition
initCoord
The position to start drawing the rectangle fromprotected java.util.Properties
properties
The object propertiesprotected 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 fileprotected
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 screenprotected void
drawBorders()
Draws black and white bordersprotected void
drawShadows()
Draws right and bottom shadowsprotected static int
findCenter(int containerSize, int itemSize)
Finds the index to start from to center an item into a containerjava.lang.String
getBackgroundColor()
backgroundColor getterColor
getColor()
color getterint
getHeight()
height getterCursorPosition
getInitCoord()
initCoord getterjava.lang.String
getTextColor()
textColor getterint
getWidth()
width getterprotected void
hideBorders()
Hides the bordersprotected void
hideShadows()
Hides the shadowsprotected void
loadPropertiesFile()
Loads the properties file
-
Field Details
-
height
protected final int heightThe rectangle height -
width
protected final int widthThe rectangle width -
color
The rectangle color scheme -
initCoord
The position to start drawing the rectangle from -
properties
protected final java.util.Properties propertiesThe object properties
-
-
Constructor Details
-
Rectangle
protected Rectangle()Default constructor
Creates a new Rectangle object, loading the settings from a file -
Rectangle
Custom constructor
Creates a new Rectangle object, using the given parameters- Parameters:
width
- the object widthheight
- the object heightinitCoord
- 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 sizeitemSize
- 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
color getter- Returns:
- the rectangle colors config
-
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
-