Pergunta

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.

Foi útil?

Solução

This fixed my issue:

setSelectedFile(f);
 final JList list = SwingUtils.getDescendantOfType(JList.class, this, "Enabled", true);
list.requestFocus();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top