标签:设置 set 条件 prim on() primary 点击 event cond
给某个控件设置鼠标点击监听器,三个条件分别判断为单击,右击还是双击
例子:
control.setOnMouseClicked(event -> { MouseButton button = event.getButton(); //单击操作 if (button == MouseButton.PRIMARY) { } //右键点击 if (button == MouseButton.SECONDARY) { } //双击操作 if (event.getClickCount() == 2) { } }
标签:设置 set 条件 prim on() primary 点击 event cond
原文地址:https://www.cnblogs.com/steveshao/p/12134306.html