Class Box

  • All Implemented Interfaces:
    Resizable
    Direct Known Subclasses:
    TextBox

    public class Box
    extends Object
    implements Resizable
    The `Box` class represents a rectangular box on a screen. It extends the `Components` class and implements the `Resizable` interface.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int c  
      protected CharSets charSets  
      protected int height  
      protected int r  
      protected int width  
    • Constructor Summary

      Constructors 
      Constructor Description
      Box​(int r, int c)
      Constructs a `Box` with specified row and column positions.
      Box​(int r, int c, int width, int height)
      Constructs a `Box` with specified parameters.
    • Field Detail

      • width

        protected int width
      • height

        protected int height
      • r

        protected int r
      • c

        protected int c
    • Constructor Detail

      • Box

        public Box​(int r,
                   int c,
                   int width,
                   int height)
        Constructs a `Box` with specified parameters.
        Parameters:
        r - The row position of the box.
        c - The column position of the box.
        width - The width of the box.
        height - The height of the box.
      • Box

        public Box​(int r,
                   int c)
        Constructs a `Box` with specified row and column positions.
        Parameters:
        r - The row position of the box.
        c - The column position of the box.
    • Method Detail

      • setWidth

        public void setWidth​(int width)
        Overrides the `setWidth` method from the `Resizable` interface.
        Specified by:
        setWidth in interface Resizable
        Parameters:
        width - The new width of the box.
      • setHeight

        public void setHeight​(int height)
        Overrides the `setHeight` method from the `Resizable` interface.
        Specified by:
        setHeight in interface Resizable
        Parameters:
        height - The new height of the box.
      • place

        public void place​(Screen sc)
        Places the box on the provided screen.
        Parameters:
        sc - The `Screen` object on which the box is placed.