检测用户何时控制单击 JTree?
使用 Java Swing JTree,有没有办法通过 TreeSelectionListener 检测用户是否“常规”单击或控制单击节点?
或者,即使没有监听器接口,也可以检测修饰键? JTree 确实根据用户按下的修饰键来处理不同的选择,但我真的想在侦听器的某些逻辑中使用这一事实。
With a Java Swing JTree, is there a way to detect if the user "regular" clicked or control-clicked on a node via a TreeSelectionListener?
Or, detect modifier keys at all, even without that listener interface? JTrees do handle selection different based on which modifer key the user holds down, but I really want to use that fact in some of the logic in a listener.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,没有。而且不应该:语义事件(如 xxSelection)的全部要点是抽象出较低级别(如没有修饰符的鼠标或键)触发器。
no, there isn't. And there shouldn't: the whole point of semantic events (like xxSelection) is to abstract away the lower level (like mouse or key w/o modifier) trigger.