This fixed my issue:
setSelectedFile(f);
final JList list = SwingUtils.getDescendantOfType(JList.class, this, "Enabled", true);
list.requestFocus();
質問
When I pop a JFileChooser with a software-selected file, that file is not highlighted among the list of files (it is, however, displayed in the "File Name: " box). The only way I can get a file to be highlighted is to mouse click on an empty space in the JFileChooser List component.
For LaF, I am using Windows.
解決
This fixed my issue:
setSelectedFile(f);
final JList list = SwingUtils.getDescendantOfType(JList.class, this, "Enabled", true);
list.requestFocus();