<Swing Dev> [9] Review request for 8152677 [macosx] All files filter can't be selected in JFileChooser

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Fri Apr 15 13:46:43 UTC 2016


Hello,

Could you review the fix:
   bug: https://bugs.openjdk.java.net/browse/JDK-8152677
   webrev: http://cr.openjdk.java.net/~alexsch/8152677/webrev.00

   FilterComboBoxModel from AquaFileChooserUI overrides 
getSelectedItem() method to always return the selected filter from the 
file chooser.

   JFileChooser.setFileFilter(FileFilter) first assign the passed filter 
to fileFilter field and then fire "fileFilterChanged" property change 
event. This leads that FilterComboBoxModel compares new file filter with 
the selected one (which has the same value because it is obtained from 
JFileChooser.fileFilter field) and do not updated JComboBox internal 
structure so JComboBox.selectedItemReminder field still points to the 
old one.

   When a user selects “All Files” filter which is the first item from a 
JFileChooser the JComboBox does not fire the action event because 
selectedItemReminder points to the same first item.

   The proposed solution is to remember the previous selected item in 
the AquaFileChooserUI.FilterComboBoxModel.

   Thanks,
   Alexandr.



More information about the swing-dev mailing list