This is to simplify `TrayIconScalingTest.java`.

1. Rename `createAndShowGUI` to `createAndShowTrayIcon` which is more specific.
2. Move creating tray icon to the top.
3. Streamline PassFailJFrame with the chained calls, including `awaitAndCheck`.
4. Ensure tray is not null before removing the icon.
5. Pass AWTException as the cause in the wrapped exception.

Previously, before the builder pattern was introduced, 
`PassFailJFrame.positionTestWindow` had had to be called to show the 
instructions UI. It's not required any more. Additionally, it has the effect of 
moving the instruction frame to the left, which doesn't look good and sometimes 
results in positioning the instructions outside of the screen bounds if the 
screen resolution is low.

With the builder pattern, the call to the `build` method shows all the 
registered windows on the screen, including the instruction frame. Since 
there's no secondary UI, the instructions remain in the centre of the screen.

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

Depends on: https://git.openjdk.org/jdk/pull/18206

Commit messages:
 - Pass AWTException as the cause in the wrapped exception
 - Re-arrange the code in TrayIconScalingTest.java

Changes: https://git.openjdk.org/jdk/pull/18224/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18224&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8327924
  Stats: 27 lines in 1 file changed: 10 ins; 11 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/18224.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18224/head:pull/18224

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

Reply via email to