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.

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

Commit messages:
 - Revert changes to PrintLatinCJKTest
 - Ensure synchronized access to windowList field
 - Add description to splitUI methods
 - Merge master
 - Update formatting in classic createUI method
 - 8294148: A test to demonstrate JSplitPane feature
 - 8294148: Use JSplitPane to display test UI with the instructions

Changes: https://git.openjdk.org/jdk/pull/17845/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17845&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294148
  Stats: 239 lines in 1 file changed: 214 ins; 4 del; 21 mod
  Patch: https://git.openjdk.org/jdk/pull/17845.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17845/head:pull/17845

PR: https://git.openjdk.org/jdk/pull/17845

Reply via email to