Class Size

java.lang.Object
org.jline.terminal.Size

public class Size extends Object
Represents the dimensions of a terminal in terms of rows and columns.

The Size class encapsulates the dimensions of a terminal screen, providing methods to get and set the number of rows and columns. Terminal dimensions are used for various operations such as cursor positioning, screen clearing, and text layout calculations.

Terminal dimensions are typically measured in character cells, where:

  • Columns - The number of character cells in each row (width)
  • Rows - The number of character cells in each column (height)

Size objects are typically obtained from a Terminal using Terminal.getSize(), and can be used to adjust display formatting or to set the terminal size using Terminal.setSize(Size).

Example usage:

 Terminal terminal = TerminalBuilder.terminal();

 // Get current terminal size
 Size size = terminal.getSize();
 System.out.println("Terminal dimensions: " + size.getColumns() + "x" + size.getRows());

 // Create a new size and set it
 Size newSize = new Size(80, 24);
 terminal.setSize(newSize);
 
See Also: