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 ColorcolorThe rectangle color schemeprotected intheightThe rectangle heightprotected CursorPositioninitCoordThe position to start drawing the rectangle fromprotected java.util.PropertiespropertiesThe object propertiesprotected intwidthThe rectangle width -
Constructor Summary
Constructors Modifier Constructor Description protectedRectangle()Default constructor
Creates a new Rectangle object, loading the settings from a fileprotectedRectangle(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 voiddrawBackground()Draws the rectangle on the screenprotected voiddrawBorders()Draws black and white bordersprotected voiddrawShadows()Draws right and bottom shadowsprotected static intfindCenter(int containerSize, int itemSize)Finds the index to start from to center an item into a containerjava.lang.StringgetBackgroundColor()backgroundColor getterColorgetColor()color getterintgetHeight()height getterCursorPositiongetInitCoord()initCoord getterjava.lang.StringgetTextColor()textColor getterintgetWidth()width getterprotected voidhideBorders()Hides the bordersprotected voidhideShadows()Hides the shadowsprotected voidloadPropertiesFile()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
-