本文整理汇总了Java中javafx.scene.Node.setOnMouseReleased方法的典型用法代码示例。如果您正苦于以下问题:Java Node.setOnMouseReleased方法的具体用法?Java Node.setOnMouseReleased怎么用?Java Node.setOnMouseReleased使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Node
的用法示例。
在下文中一共展示了Node.setOnMouseReleased方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MouseTracker
import javafx.scene.Node; //导入方法依赖的package包/类
public MouseTracker(final Node owner) {
owner.setOnMouseMoved(this.onMouseMovedEventHandler);
owner.setOnMouseClicked(this.onMouseClickedEventHandler);
owner.setOnMouseEntered(this.onMouseEnteredEventHandler);
owner.setOnMouseExited(this.onMouseExitedEventHandler);
owner.setOnMouseDragged(this.onMouseDraggedEventHandler);
owner.setOnMousePressed(this.onMousePressedEventHandler);
owner.setOnMouseReleased(this.onMouseReleasedEventHandler);
// Register our own event handler to register mouse placement at all times
owner.addEventFilter(MouseEvent.ANY, event -> {
if(!Double.isNaN(event.getX())) {
xProperty.set(event.getX());
}
if(!Double.isNaN(event.getY())) {
yProperty.set(event.getY());
}
});
}
示例2: makeDraggable
import javafx.scene.Node; //导入方法依赖的package包/类
public void makeDraggable(final Node node) {
node.setOnMousePressed(onMousePressedEventHandler);
node.setOnMouseDragged(onMouseDraggedEventHandler);
node.setOnMouseReleased(onMouseReleasedEventHandler);
}