On Wed, 7 Dec 2022 11:37:30 GMT, Tejesh R <t...@openjdk.org> wrote:

>> 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);
>
> JFileChooser added to a JFrame similar to the example also works, I guess 
> it's because frame is made inaccessible. But when we try to disable 
> JFileChooser alone, it's not working because we need to disable each 
> sub-component in which JFileChooser is made up of. As per debugging I found 
> out that peer component is showing null for JFileChooser.disable whereas for 
> JFrame the disabling is taken care by peer component in Component class.

Why we cannot make inaccessible JFileChooser same as JFrame? We do not need to 
mark disable all components inside the frame(I guess jdialog and windows as 
well). Both are top level components, and probably should work in the same way.

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

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

Reply via email to