RFR: 6972078: Can not select single directory with GTKLookAndFeel

Tejesh R tr at openjdk.org
Wed Oct 26 10:35:54 UTC 2022


On Wed, 26 Oct 2022 04:34:24 GMT, Abhishek Kumar <duke at openjdk.org> wrote:

> While using a JFileChooser with the file selection mode FILES_AND_DIRECTORIES and multiSelection enabled, it is impossible to select a single directory in GTK LAF.
> 
> The condition check has been modified when multiselection is enabled and user has selected single directory.
> After the fix the behavior of JFileChooser is similar to other LAFs.
> 
> An automatic test case `test/jdk/com/sun/java/swing/plaf/gtk/TestFileChooserSingleDirectorySelection.java` is implemented and checked in CI pipeline. Link is attached in JBS.

test/jdk/com/sun/java/swing/plaf/gtk/TestFileChooserSingleDirectorySelection.java line 73:

> 71:             robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
> 72:             robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
> 73:             robot.delay(100);

robot.mouseMove(pt.x + getSelectedFilesButton.getWidth() / 2,
                            pt.y + getSelectedFilesButton.getHeight() / 2);
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            robot.delay(100);

`ClickMouse` method can be reused instead.

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

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



More information about the client-libs-dev mailing list