Frage

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.

War es hilfreich?

Lösung

This fixed my issue:

setSelectedFile(f);
 final JList list = SwingUtils.getDescendantOfType(JList.class, this, "Enabled", true);
list.requestFocus();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top