On Wed, 14 Feb 2024 13:22:48 GMT, Alexey Ivanov <aiva...@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.

See PR #17847 for a real-life usage example of `splitUI`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17845#issuecomment-1943845712

Reply via email to