Class TerminalRectangle
java.lang.Object
com.googlecode.lanterna.TerminalRectangle
This class is immutable and cannot change its internal state after creation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intfinal TerminalPositionfinal TerminalSizefinal intfinal intfinal intfinal intfinal int -
Constructor Summary
ConstructorsConstructorDescriptionTerminalRectangle(int x, int y, int width, int height) Creates a new terminal rect representation at the supplied x y position with the supplied width and height. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintintgetRows()inthashCode()toString()booleanwhenContains(int x, int y, Runnable op) booleanwhenContains(TerminalPosition p, Runnable op) withColumns(int columns) Creates a new rect based on this rect, but with a different widthwithRows(int rows) Creates a new rect based on this rect, but with a different height
-
Field Details
-
position
-
size
-
x
public final int x -
y
public final int y -
width
public final int width -
height
public final int height -
xAndWidth
public final int xAndWidth -
yAndHeight
public final int yAndHeight
-
-
Constructor Details
-
TerminalRectangle
public TerminalRectangle(int x, int y, int width, int height) Creates a new terminal rect representation at the supplied x y position with the supplied width and height. Both width and height must be at least zero (non negative) as checked in TerminalSize.- Parameters:
width- number of columnsheight- number of rows
-
-
Method Details
-
getColumns
public int getColumns()- Returns:
- Returns the width of this rect, in number of columns
-
getRows
public int getRows()- Returns:
- Returns the height of this rect representation, in number of rows
-
withColumns
Creates a new rect based on this rect, but with a different width- Parameters:
columns- Width of the new rect, in columns- Returns:
- New rect based on this one, but with a new width
-
withRows
Creates a new rect based on this rect, but with a different height- Parameters:
rows- Height of the new rect, in rows- Returns:
- New rect based on this one, but with a new height
-
whenContains
-
whenContains
-
toString
-
equals
-
hashCode
-