RFR: 4365952: Cannot disable JFileChooser

Sergey Bylokhov serb at openjdk.org
Wed Dec 7 10:30:28 UTC 2022


On Wed, 7 Dec 2022 05:48:57 GMT, Tejesh R <tr at openjdk.org> wrote:

> Disable functionality not working for JFileChooser. `public void setEnabled(boolean enabled)` functionality is overridden in JFileChooser class which enable/disable each sub-component of FileChooser. 
> The added functionality is tested in mach5 and no regression found. The fix includes automated test which clicks _home_ directory and then compares which default selectedDirectory to check if JFileChooser is disabled. This is tested in mach5 for all platforms with multiple test runs.

src/java.desktop/share/classes/javax/swing/JFileChooser.java line 420:

> 418: 
> 419:     @Override
> 420:     public void setEnabled(boolean enabled) {

Can you please check why a similar example using JFrame and button works fine, but the JFileChooser does not work?

        JFrame frame = new JFrame();
        JButton button = new JButton("1234567890");
        frame.add(button);
        frame.setVisible(true);
        frame.setEnabled(false);
        boolean enabled = button.isEnabled();
        System.out.println("enabled = " + enabled);

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

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



More information about the client-libs-dev mailing list