Class 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.
    • 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.