Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8340784 : Remove PassFailJFrame constructor with screenshots #22873

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 9 additions & 51 deletions test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -359,7 +359,7 @@ public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER}
* the default values of {@value #ROWS} and {@value #COLUMNS}
* for rows and columns.
* <p>
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
* See {@link #PassFailJFrame(String,String,long,int,int)} for
* more details.
*
* @param instructions the instructions for the tester
Expand All @@ -382,7 +382,7 @@ public PassFailJFrame(String instructions)
* and the default values of {@value #ROWS} and {@value #COLUMNS}
* for rows and columns.
* <p>
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
* See {@link #PassFailJFrame(String,String,long,int,int)} for
* more details.
*
* @param instructions the instructions for the tester
Expand All @@ -404,9 +404,8 @@ public PassFailJFrame(String instructions, long testTimeOut)
* with the given title, instructions and timeout as well as
* the default values of {@value #ROWS} and {@value #COLUMNS}
* for rows and columns.
* The screenshot feature is not enabled, if you use this constructor.
* <p>
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
* See {@link #PassFailJFrame(String,String,long,int,int)} for
* more details.
*
* @param title the title of the instruction frame
Expand All @@ -424,41 +423,11 @@ public PassFailJFrame(String title, String instructions,
this(title, instructions, testTimeOut, ROWS, COLUMNS);
}

/**
* Constructs a frame which displays test instructions and
* the <i>Pass</i> / <i>Fail</i> buttons
* with the given title, instructions, timeout, number of rows and columns.
* The screenshot feature is not enabled, if you use this constructor.
* <p>
* See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for
* more details.
*
* @param title the title of the instruction frame
* @param instructions the instructions for the tester
* @param testTimeOut the test timeout in minutes
* @param rows the number of rows for the text component
* which displays test instructions
* @param columns the number of columns for the text component
* which displays test instructions
*
* @throws InterruptedException if the current thread is interrupted
* while waiting for EDT to finish creating UI components
* @throws InvocationTargetException if an exception is thrown while
* creating UI components on EDT
*/
public PassFailJFrame(String title, String instructions,
long testTimeOut,
int rows, int columns)
throws InterruptedException, InvocationTargetException {
this(title, instructions, testTimeOut, rows, columns, false);
}

/**
* Constructs a frame which displays test instructions and
* the <i>Pass</i> / <i>Fail</i> buttons
* as well as supporting UI components with the given title, instructions,
* timeout, number of rows and columns,
* and screen capture functionality.
* timeout, number of rows and columns.
* All the UI components are created on the EDT, so it is safe to call
* the constructor on the main thread.
* <p>
Expand All @@ -483,12 +452,6 @@ public PassFailJFrame(String title, String instructions,
* the size of a text component which displays the instructions.
* The preferred size of the instructions is calculated by
* creating {@code new JTextArea(rows, columns)}.
* <p>
* If you enable screenshots by setting the {@code screenCapture}
* parameter to {@code true}, a <i>Screenshot</i> button is added.
* Clicking the <i>Screenshot</i> button takes screenshots of
* all the monitors or all the windows registered with
* {@code PassFailJFrame}.
*
* @param title the title of the instruction frame
* @param instructions the instructions for the tester
Expand All @@ -497,8 +460,6 @@ public PassFailJFrame(String title, String instructions,
* which displays test instructions
* @param columns the number of columns for the text component
* which displays test instructions
* @param screenCapture if set to {@code true}, enables screen capture
* functionality
*
* @throws InterruptedException if the current thread is interrupted
* while waiting for EDT to finish creating UI components
Expand All @@ -510,13 +471,11 @@ public PassFailJFrame(String title, String instructions,
*/
public PassFailJFrame(String title, String instructions,
long testTimeOut,
int rows, int columns,
boolean screenCapture)
int rows, int columns)
throws InterruptedException, InvocationTargetException {
invokeOnEDT(() -> createUI(title, instructions,
testTimeOut,
rows, columns,
screenCapture));
rows, columns));
}

/**
Expand Down Expand Up @@ -613,8 +572,7 @@ private static void invokeOnEDTUncheckedException(Runnable doRun) {
}

private static void createUI(String title, String instructions,
long testTimeOut, int rows, int columns,
boolean enableScreenCapture) {
long testTimeOut, int rows, int columns) {
frame = new JFrame(title);
frame.setLayout(new BorderLayout());

Expand All @@ -623,7 +581,7 @@ private static void createUI(String title, String instructions,
frame.add(createInstructionUIPanel(instructions,
testTimeOut,
rows, columns,
enableScreenCapture,
false,
false, 0),
BorderLayout.CENTER);
frame.pack();
Expand Down