Package me.araopj.cscreen.components
Class Screen
- java.lang.Object
-
- me.araopj.cscreen.components.Screen
-
public class Screen extends Object
The `Screen` class represents a screen with the ability to display components and borders. It includes features like setting dimensions, adding titles, and generating the screen layout.
-
-
Constructor Summary
Constructors Constructor Description Screen()Constructs a `Screen` with default dimensions and no border.Screen(int r, int c)Constructs a `Screen` with specified dimensions and no border.Screen(int r, int c, boolean hasBorder)Constructs a `Screen` with specified dimensions and an optional border.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTitle(String title, Position pos)Adds a title to the screen at the specified position.voiddisplay()Displays the screen by printing its content to the console.voidgenerateScreen()Generates the initial layout of the screen, including borders if specified.protected voidsetCharSets(Symbol symbol)Sets the character sets for drawing on the screen.voidsetDimension(int r, int c)Sets the dimensions of the screen.voidsetTitle(String title)Sets the title of the screen at the specified position.voidsetTitlePosition(Position pos)Sets the position of the title on the screen.voiduseBoxSet()Sets the character set to use box drawing characters and generates the screen layout.
-
-
-
Constructor Detail
-
Screen
public Screen()
Constructs a `Screen` with default dimensions and no border.
-
Screen
public Screen(int r, int c)Constructs a `Screen` with specified dimensions and no border.- Parameters:
r- The number of rows in the screen.c- The number of columns in the screen.
-
Screen
public Screen(int r, int c, boolean hasBorder)Constructs a `Screen` with specified dimensions and an optional border.- Parameters:
r- The number of rows in the screen.c- The number of columns in the screen.hasBorder- A boolean indicating whether the screen should have a border.
-
-
Method Detail
-
setCharSets
protected void setCharSets(Symbol symbol)
Sets the character sets for drawing on the screen.- Parameters:
symbol- The `Symbol` enum representing the character set to be used.
-
useBoxSet
public void useBoxSet()
Sets the character set to use box drawing characters and generates the screen layout.
-
setDimension
public void setDimension(int r, int c)Sets the dimensions of the screen.- Parameters:
r- The number of rows in the screen.c- The number of columns in the screen.
-
setTitle
public void setTitle(String title)
Sets the title of the screen at the specified position.- Parameters:
title- The title to be set on the screen.
-
setTitlePosition
public void setTitlePosition(Position pos)
Sets the position of the title on the screen.- Parameters:
pos- The `Position` enum representing the position of the title.
-
addTitle
public void addTitle(String title, Position pos)
Adds a title to the screen at the specified position.- Parameters:
title- The title to be added to the screen.pos- The `Position` enum representing the position of the title.
-
generateScreen
public void generateScreen()
Generates the initial layout of the screen, including borders if specified.
-
display
public void display()
Displays the screen by printing its content to the console.
-
-