문제

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top