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.
我在 jtree 中为方法单击编写代码,但我只想在左键单击时执行该操作
class SelectionListener extends DefaultMutableTreeNode implements TreeSelectionListener { public void valueChanged(TreeSelectionEvent se) {...}
如果您正在捕获 aMouseEvent那么您可以使用以下方法来检查单击是否是左键单击:
MouseEvent
SwingUtilities.isLeftMouseButton(mouseEvent)