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 和一个 JButton,用户可以单击 JList 中的一个项目,也可以单击该按钮,当单击该按钮时如何取消选择(将选定的列表项 bgcolor 更改为正常,换句话说,什么都没有单击按钮后将选择 JList 中的项目)来自 JList 的项目?
JList应该有一个可以调用的clearSelection()方法。
clearSelection()