本文整理汇总了Java中javafx.scene.Cursor.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.toString方法的具体用法?Java Cursor.toString怎么用?Java Cursor.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Cursor
的用法示例。
在下文中一共展示了Cursor.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBox
import javafx.scene.Cursor; //导入方法依赖的package包/类
private Node createBox(Cursor cursor) {
Label label = new Label(cursor.toString());
label.setAlignment(Pos.CENTER);
label.setPrefSize(85, 85);
label.setStyle("-fx-border-color: #aaaaaa; -fx-background-color: #dddddd;");
label.setCursor(cursor);
return label;
}
示例2: ResizeAnchor
import javafx.scene.Cursor; //导入方法依赖的package包/类
public ResizeAnchor(MainController mainController, Cursor cursor, Rectangle focusRectangle) {
super();
this.mainController = mainController;
setWidth(Data.RESIZE_ANCHOR_DIMENSION);
setHeight(Data.RESIZE_ANCHOR_DIMENSION);
setFill(Color.WHITE);
setStrokeWidth(2.0);
setStroke(Data.FOCUS_OUTLINE_COLOR);
setCursor(cursor);
MouseEventHandler resizeEventHandler = new ResizeEventHandler(this.mainController);
setOnMousePressed(resizeEventHandler.getMousePressedEventHandler());
setOnMouseDragged(resizeEventHandler.getMouseDraggedEventHandler());
setOnMouseReleased(resizeEventHandler.getMouseReleasedEventHandler());
switch (cursor.toString()) {
case "NW_RESIZE": {
xProperty().bind(focusRectangle.xProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "NE_RESIZE": {
xProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION/2));
break;
}
case "SE_RESIZE": {
xProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "SW_RESIZE": {
xProperty().bind(focusRectangle.xProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION/2));
yProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "N_RESIZE": {
xProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty().divide(2)).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "E_RESIZE": {
xProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty().divide(2)).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "S_RESIZE": {
xProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty().divide(2)).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty()).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
case "W_RESIZE": {
xProperty().bind(focusRectangle.xProperty().subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
yProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty().divide(2)).subtract(Data.RESIZE_ANCHOR_DIMENSION / 2));
break;
}
}
// Apply rotation to resize anchors
getTransforms().addAll(focusRectangle.getTransforms());
}