RFR: 8294535 : Add screen capture functionality to PassFailJFrame
Harshitha Onkar
honkar at openjdk.org
Fri May 26 19:33:56 UTC 2023
On Wed, 24 May 2023 19:32:52 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> 1) Used builder pattern
>> 2) Tested AWT tests and it passed
>
> test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 309:
>
>> 307: JOptionPane.showMessageDialog(frame, "Screen Captured " +
>> 308: "Successfully", "Screen Capture",
>> 309: JOptionPane.INFORMATION_MESSAGE);
>
> Suggestion:
>
> JOptionPane.showMessageDialog(frame,
> "Screen captured successfully",
> "Screen Capture",
> JOptionPane.INFORMATION_MESSAGE);
>
> It's better not to split strings unnecessarily. The messages usually use regular capitalisation as opposed to title capitalisation.
@aivanov-jdk, @lawrence-andrew
> If the displayed message isn't modal, like a tooltip or a notification which disappears automatically after a certain time, it could be better appreciated. But it's harder to implement.
We could use Timer for disappearing messages, but might be an overkill here.
JOptionPane pane = new JOptionPane("Screen capture successful", JOptionPane.INFORMATION_MESSAGE);
final JDialog dialog = pane.createDialog("Screen Capture");
Timer timer = new Timer(2000, e -> dialog.dispose());
timer.setRepeats(false);
timer.start();
dialog.setVisible(true);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14094#discussion_r1207245091
More information about the client-libs-dev
mailing list