Skip to content
Snippets Groups Projects
Commit 17f35ba1 authored by Goetz Lindenmaier's avatar Goetz Lindenmaier
Browse files

8340308: PassFailJFrame: Make rows default to number of lines in instructions

Backport-of: d1d824008d1dc70029013820814fd03c40b4e309
parent 5e3c5d99
No related branches found
No related tags found
No related merge requests found
......@@ -1184,11 +1184,45 @@ public final class PassFailJFrame {
return this;
}
/**
* Sets the number of rows for displaying the instruction text.
* The default value is the number of lines in the text plus 1:
* {@code ((int) instructions.lines().count() + 1)}.
*
* @param rows the number of rows for instruction text
* @return this builder
*/
public Builder rows(int rows) {
this.rows = rows;
return this;
}
private int getDefaultRows() {
return (int) instructions.lines().count() + 1;
}
/**
* Adds a certain number of rows for displaying the instruction text.
*
* @param rowsAdd the number of rows to add to the number of rows
* @return this builder
* @see #rows
*/
public Builder rowsAdd(int rowsAdd) {
if (rows == 0) {
rows = getDefaultRows();
}
rows += rowsAdd;
return this;
}
/**
* Sets the number of columns for displaying the instruction text.
*
* @param columns the number of columns for instruction text
* @return this builder
*/
public Builder columns(int columns) {
this.columns = columns;
return this;
......@@ -1483,7 +1517,7 @@ public final class PassFailJFrame {
}
if (rows == 0) {
rows = ROWS;
rows = getDefaultRows();
}
if (columns == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment