Class Label


  • public class Label
    extends Object
    The `Label` class represents a simple label component that displays text on a screen. It extends the `Components` class to inherit basic component functionality.
    • Field Detail

      • r

        protected int r
      • c

        protected int c
    • Constructor Detail

      • Label

        public Label​(int r,
                     int c,
                     String text)
        Constructs a `Label` with the specified row, column, and text.
        Parameters:
        r - The row position of the label on the screen.
        c - The column position of the label on the screen.
        text - The text content of the label.
      • Label

        public Label​(int r,
                     int c)
        Constructs a `Label` with the specified row and column.
        Parameters:
        r - The row position of the label on the screen.
        c - The column position of the label on the screen.
    • Method Detail

      • place

        public void place​(Screen sc)
        Places the label on the screen by updating the screen array with its text content.
        Parameters:
        sc - The `Screen` object representing the screen to which the label is being added.
      • setText

        public void setText​(String text)
        Sets the text content of the label.
        Parameters:
        text - The new text content for the label.
      • getText

        public String getText()
        Retrieves the current text content of the label.
        Returns:
        The text content of the label.