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


Java MouseDragEvent类代码示例

本文整理汇总了Java中javafx.scene.input.MouseDragEvent的典型用法代码示例。如果您正苦于以下问题:Java MouseDragEvent类的具体用法?Java MouseDragEvent怎么用?Java MouseDragEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MouseDragEvent类属于javafx.scene.input包,在下文中一共展示了MouseDragEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeOldMouseDragHandlers

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
/**
 * Removes any previously existing mouse-drag event handlers from the connector's root JavaFX node that were added
 * by this class.
 *
 * @param connector the {@link GConnector} whose old handlers should be removed
 */
private void removeOldMouseDragHandlers(final GConnector connector) {

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    if (dragDetectedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.DRAG_DETECTED, dragDetectedHandlers.get(connector));
    }

    if (mouseDraggedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseDraggedHandlers.get(connector));
    }

    if (mouseDragEnteredHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, mouseDragEnteredHandlers.get(connector));
    }

    if (mouseDragExitedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, mouseDragExitedHandlers.get(connector));
    }

    if (mouseDragReleasedHandlers.get(connector) != null) {
        root.removeEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, mouseDragReleasedHandlers.get(connector));
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:ConnectorDragManager.java

示例2: addMouseDragHandlers

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
/**
 * Adds mouse-drag handlers to a particular connector.
 *
 * @param connector the {@link GConnector} to which mouse-drag handlers should be added
 */
private void addMouseDragHandlers(final GConnector connector) {

    final EventHandler<MouseEvent> newDragDetectedHandler = event -> handleDragDetected(event, connector);
    final EventHandler<MouseEvent> newMouseDraggedHandler = event -> handleMouseDragged(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragEnteredHandler = event -> handleDragEntered(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragExitedHandler = event -> handleDragExited(event, connector);
    final EventHandler<MouseDragEvent> newMouseDragReleasedHandler = event -> handleDragReleased(event, connector);

    final Node root = skinLookup.lookupConnector(connector).getRoot();

    root.addEventHandler(MouseEvent.DRAG_DETECTED, newDragDetectedHandler);
    root.addEventHandler(MouseEvent.MOUSE_DRAGGED, newMouseDraggedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED, newMouseDragEnteredHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_EXITED, newMouseDragExitedHandler);
    root.addEventHandler(MouseDragEvent.MOUSE_DRAG_RELEASED, newMouseDragReleasedHandler);
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:22,代码来源:ConnectorDragManager.java

示例3: genMouseDrag

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
/**
 * create a drag mouseEvent
 */
private MouseDragEvent genMouseDrag(double x, double y) {
    return new MouseDragEvent(
            MouseDragEvent.MOUSE_DRAG_ENTERED,
            x,
            y,
            x,
            y,
            MouseButton.PRIMARY,
            1,
            false,
            false,
            false,
            false,
            true, //left click down
            false,
            false,
            false,
            false,
            new PickResult(null, x, y),
            genMouseClick(MouseEvent.MOUSE_PRESSED, 0, 0) //drag from origin
    );
}
 
开发者ID:UQdeco2800,项目名称:minesim,代码行数:26,代码来源:MouseHandlerTest.java

示例4: handleMouseDragEntered

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void handleMouseDragEntered(MouseDragEvent event) {
    if(overDD != null) {
        overDD.getStyleClass().removeAll("drag-over");
    }
    overDD = ((Node)event.getSource());
    ((Node)event.getSource()).getStyleClass().add("drag-over");
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:9,代码来源:DragAndDrop.java

示例5: register

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void register(Node node) {
    requireNonNull(node, "Parameter 'node' is null");

    node.addEventFilter(MouseEvent.MOUSE_DRAGGED, dragHandler);
    node.addEventFilter(MouseDragEvent.MOUSE_RELEASED, dragFinishedHandler);
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:8,代码来源:DragActionHandler.java

示例6: unregister

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void unregister(Node node) {
    requireNonNull(node, "Parameter 'node' is null");

    node.removeEventFilter(MouseEvent.MOUSE_DRAGGED, dragHandler);
    node.removeEventFilter(MouseDragEvent.MOUSE_RELEASED, dragFinishedHandler);
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:8,代码来源:DragActionHandler.java

示例7: setupMousePlane

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
/** Sets up the invisible mouse plane that is needed for the dragging of nodes on the scene using the mouse.
 * The index of the mouse plane should be the same as the index for enableNewFocusPoint.
 * @param index the index of the rectangle in a rectangle list that will be used for dragging that specific object
 * 
 */
private Rectangle setupMousePlane(int index) {

    mousePlaneList.get(index).setLayoutX(-800 / 2);
    mousePlaneList.get(index).setLayoutY(-800 / 2);
    mousePlaneList.get(index).setOpacity(0.7);
    mousePlaneList.get(index).setMouseTransparent(true);
    mousePlaneList.get(index).setDepthTest(DepthTest.DISABLE); // this makes the plane to be picked even if there are objects closer to the camera

    mousePlaneList.get(index).setOnMouseDragOver(new EventHandler<MouseDragEvent>() {
        @Override
        public void handle(MouseDragEvent me) {
            if (me.isSecondaryButtonDown() && me.isAltDown()) {
                //do nothing, we are rotating on the gizmo
            } else if (me.isSecondaryButtonDown()) {
                Point3D coords = me.getPickResult().getIntersectedPoint();
                mouseOldX = mousePosX;
                mouseOldY = mousePosY;
                mousePosX = coords.getX();
                mousePosY = coords.getY();

                double z = coords.getZ();

                coords = mousePlaneList.get(index).localToParent(new Point3D(mousePosX, mousePosY, z)); //mouseplane has the same parent as the real plane and objects like cube
                mousePosX = coords.getX();
                mousePosY = coords.getY();
                mouseDeltaX = (mousePosX - mouseOldX);
                mouseDeltaY = (mousePosY - mouseOldY);

            }
        }
    });
    return mousePlaneList.get(index);
}
 
开发者ID:VRL-Studio,项目名称:VRL-JFXVis,代码行数:39,代码来源:Main.java

示例8: handleMouseDragReleased

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void handleMouseDragReleased(Node endRegion, MouseDragEvent event) {
    Region source = (Region) event.getGestureSource();
    Region target = (Region) endRegion;

    sourceDD = null;

    source.getStyleClass().removeAll("drag-launch");

    if(source.equals(target)) {
        if(preview != null) {
            preview.close();
        }
        return;
    }

    if(!event.isConsumed()) {
        event.consume();
    } else {
        return;
    }




    if(host.getObjects().indexOf(target) > host.getObjects().indexOf(source)) {

        host.getObjects().remove(source);
        host.getObjects().add(host.getObjects().indexOf(target)+1, source);
    } else {

        host.getObjects().remove(source);
        host.getObjects().add(host.getObjects().indexOf(target), source);
    }

    if(preview!=null) {
        preview.close();
        preview = null;
    }

    host.update();

    for(ActionCompletedListener acl : acls ){
        acl.update();
    }
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:47,代码来源:DragAndDrop.java

示例9: addHandleMouseDragExited

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void addHandleMouseDragExited(EventHandler<MouseDragEvent> event) {
    dragMouseExitedEvents.add(event);
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:5,代码来源:MultiObjectPane.java

示例10: addHandleMouseDragEntered

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void addHandleMouseDragEntered(EventHandler<MouseDragEvent> event) {
    dragMouseEnteredEvents.add(event);
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:5,代码来源:MultiObjectPane.java

示例11: addHandleMouseDragReleased

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void addHandleMouseDragReleased(EventHandler<MouseDragEvent> event) {
    mouseDragReleasedEvents.add(event);
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:5,代码来源:MultiObjectPane.java

示例12: handleMouseDragExited

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void handleMouseDragExited(MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : dragMouseExitedEvents) {
        h.handle(event);
    }
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:7,代码来源:MultiObjectPane.java

示例13: handleMouseDragEntered

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void handleMouseDragEntered(MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : dragMouseEnteredEvents) {
        h.handle(event);
    }
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:7,代码来源:MultiObjectPane.java

示例14: handleMouseDragReleased

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@Override
public void handleMouseDragReleased(Node endRegion, MouseDragEvent event) {
    for (EventHandler<MouseDragEvent> h : mouseDragReleasedEvents) {
        h.handle(event);
    }
}
 
开发者ID:j6mes,项目名称:fluidgrid,代码行数:7,代码来源:MultiObjectPane.java

示例15: compositeTokenPane_MouseDragExited

import javafx.scene.input.MouseDragEvent; //导入依赖的package包/类
@FXML
void compositeTokenPane_MouseDragExited(MouseDragEvent event) {
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:4,代码来源:TokenTool_Controller.java


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