RFR: 4834298: JFileChooser.getSelectedFiles() failed with multi-selection and double-click [v3]

Tejesh R tr at openjdk.org
Thu Sep 8 10:45:50 UTC 2022


On Thu, 8 Sep 2022 10:38:22 GMT, Tejesh R <tr at openjdk.org> wrote:

>> src/java.desktop/share/classes/sun/swing/FilePane.java line 1772:
>> 
>>> 1770:         } else {
>>> 1771:             listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
>>> 1772:             clearSelection();
>> 
>> When we move from multi-selection enabled to disable. We are clearing the selection and calling setSelectedFiles(null). Do we need to replicate similar state update when we move from multi-selection disable to enable (clearing selection and calling setSelectedFile(null))?
>> 
>> It looks like somewhere we are not clearing SelectedFile() and it is causing this issue.
>
> If we replicate the same then previously selected files will be cleared and user wont be able to retain the selected files.

Clearing the selection from multi to single is fine, but the reverse might not be right I guess..... Since selected file/files can be retained when user switch to multi selection.

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

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



More information about the client-libs-dev mailing list