Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在导入文件后填充的 JList。是否可以突出显示/选择 JList 的第一个项目/元素。我浏览了很多地方,希望能找到一条线
list.setFocus(0); //or listSelectionEvent.setSelection(0); //0 referring to index point of the list
也许这甚至不可能......?
采用:
list.setSelectedIndex(0);