Skip to content

Commit 17f35ba

Browse files
committed
8340308: PassFailJFrame: Make rows default to number of lines in instructions
Backport-of: d1d824008d1dc70029013820814fd03c40b4e309
1 parent 5e3c5d9 commit 17f35ba

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

test/jdk/java/awt/regtesthelpers/PassFailJFrame.java

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,11 +1184,45 @@ public Builder testTimeOut(long testTimeOut) {
11841184
return this;
11851185
}
11861186

1187+
/**
1188+
* Sets the number of rows for displaying the instruction text.
1189+
* The default value is the number of lines in the text plus 1:
1190+
* {@code ((int) instructions.lines().count() + 1)}.
1191+
*
1192+
* @param rows the number of rows for instruction text
1193+
* @return this builder
1194+
*/
11871195
public Builder rows(int rows) {
11881196
this.rows = rows;
11891197
return this;
11901198
}
11911199

1200+
private int getDefaultRows() {
1201+
return (int) instructions.lines().count() + 1;
1202+
}
1203+
1204+
/**
1205+
* Adds a certain number of rows for displaying the instruction text.
1206+
*
1207+
* @param rowsAdd the number of rows to add to the number of rows
1208+
* @return this builder
1209+
* @see #rows
1210+
*/
1211+
public Builder rowsAdd(int rowsAdd) {
1212+
if (rows == 0) {
1213+
rows = getDefaultRows();
1214+
}
1215+
rows += rowsAdd;
1216+
1217+
return this;
1218+
}
1219+
1220+
/**
1221+
* Sets the number of columns for displaying the instruction text.
1222+
*
1223+
* @param columns the number of columns for instruction text
1224+
* @return this builder
1225+
*/
11921226
public Builder columns(int columns) {
11931227
this.columns = columns;
11941228
return this;
@@ -1483,7 +1517,7 @@ private void validate() {
14831517
}
14841518

14851519
if (rows == 0) {
1486-
rows = ROWS;
1520+
rows = getDefaultRows();
14871521
}
14881522

14891523
if (columns == 0) {

0 commit comments

Comments
 (0)