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 用任何鼠标按钮选择它的项目,而不仅仅是左边的?
谢谢!
哦,刚刚找到了功能
int s = list.locationToIndex(e.getPoint()); list.setSelectedIndex(s);
当您在鼠标侦听器中执行此操作时,它就可以完成工作。