Integrated: 8294148: Support JSplitPane for instructions and test UI
Alexey Ivanov
aivanov at openjdk.org
Tue Feb 20 16:32:58 UTC 2024
On Wed, 14 Feb 2024 13:22:48 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> This enhancement adds three methods to `PassFailJFrame.Builder`:
>
> 1. **`splitUIRight`** to display test UI to the right of the instructions;
> 2. **`splitUIBottom`** to display test UI to the bottom of the instructions;
> 3. `splitUI`: a convenience method for a default split orientation, currently defaults to `splitUIRight`.
>
> If UI of a test is simple, it's reasonable to embed the test UI into the instruction UI. In this case, there's only one frame the tester will be interacting with.
>
> The implementation is similar to that of `testUI` provided under [JDK-8294156](https://bugs.openjdk.org/browse/JDK-8294156). The `splitUI-` method accept a reference to `PanelCreator` interface. Instead of creating an entire frame, you create only a component, usually a `JPanel` or `Box`, which contains all the test UI.
>
> For example,
>
>
> PassFailJFrame.builder()
> .instructions("Instructions for the test")
> .splitUI(() -> {
> JPanel panel = new JPanel();
> panel.add(new JButton("Click Me"));
> return panel;
> })
> .build()
> .awaitAndCheck();
>
>
> In addition to it, there's an advanced `testUI` method which accepts `PanelCreator`; in this case the test UI is hosted in `JDialog` with the instruction frame being its owner. Because the test UI is in a modeless owned dialog, it always displays above the instruction frame, switch to the test app brings up both the instructions and test UI. I don't expect it'd be used often, yet it's easy to implement.
This pull request has now been integrated.
Changeset: b419e951
Author: Alexey Ivanov <aivanov at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b419e9517361ed9d28f8ab2f5beacf5adfe3db91
Stats: 239 lines in 1 file changed: 214 ins; 4 del; 21 mod
8294148: Support JSplitPane for instructions and test UI
Reviewed-by: honkar, dmarkov
-------------
PR: https://git.openjdk.org/jdk/pull/17845
More information about the client-libs-dev
mailing list