8340308: PassFailJFrame: Make rows default to number of lines in instructions
Reviewed-by: honkar, azvegint
This commit is contained in:
parent
bc36ace72c
commit
d1d824008d
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user