当前位置: 首页>>代码示例>>Java>>正文


Java Cursor.toString方法代码示例

本文整理汇总了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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:CursorSample.java

示例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());
}
 
开发者ID:pfolta,项目名称:Shapify,代码行数:75,代码来源:ResizeAnchor.java


注:本文中的javafx.scene.Cursor.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。