Skip to content

Commit

Permalink
Add logArea placeholder text
Browse files Browse the repository at this point in the history
  • Loading branch information
azvegint committed Mar 15, 2024
1 parent 9cc0396 commit 77e5e4a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public final class PassFailJFrame {
private static Robot robot;

private static JTextArea logArea;
private static boolean isLogAreaFirstAppend = true;

public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER}

Expand Down Expand Up @@ -478,7 +479,8 @@ private static JComponent createInstructionUIPanel(String instructions,
}

if (addLogArea) {
logArea = new JTextArea(logAreaRows, columns);
logArea = new JTextArea("(the test log will be here)",
logAreaRows, columns);
logArea.setEditable(false);

Box buttonsLogPanel = Box.createVerticalBox();
Expand Down Expand Up @@ -1082,7 +1084,14 @@ public static void forceFail(String reason) {
* @param message to log
*/
public static void log(String message) {
invokeOnEDTUncheckedException(() -> logArea.append(message + "\n"));
invokeOnEDTUncheckedException(() -> {
if (isLogAreaFirstAppend) {
logArea.setText(message + "\n");
isLogAreaFirstAppend = false;
} else {
logArea.append(message + "\n");
}
});
}

/**
Expand Down

0 comments on commit 77e5e4a

Please sign in to comment.