javafx.scene.Node.setOnMouseDragged()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中javafx.scene.Node.setOnMouseDragged()方法的一些代码示例,展示了Node.setOnMouseDragged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.setOnMouseDragged()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:setOnMouseDragged

Node.setOnMouseDragged介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. private void addDraggableNode(final Node node) {
  2. node.setOnMousePressed(new EventHandler<MouseEvent>() {
  3. @Override
  4. public void handle(MouseEvent me) {
  5. if (me.getButton() != MouseButton.MIDDLE) {
  6. initialX = me.getSceneX();
  7. initialY = me.getSceneY();
  8. }
  9. }
  10. });
  11. node.setOnMouseDragged(new EventHandler<MouseEvent>() {
  12. @Override
  13. public void handle(MouseEvent me) {
  14. if (me.getButton() != MouseButton.MIDDLE) {
  15. node.getScene().getWindow().setX(me.getScreenX() - initialX);
  16. node.getScene().getWindow().setY(me.getScreenY() - initialY);
  17. }
  18. }
  19. });
  20. }

代码示例来源:origin: stackoverflow.com

  1. byNode.setOnMouseDragged(mouseEvent -> {
  2. stage.setX(mouseEvent.getScreenX() + dragDelta.x);
  3. stage.setY(mouseEvent.getScreenY() + dragDelta.y);

代码示例来源:origin: stackoverflow.com

  1. node.setOnMouseDragged(new EventHandler<MouseEvent>() {
  2. public void handle(MouseEvent e) {
  3. Point2D localPoint = sceneRoot.sceneToLocal(new Point2D(e.getSceneX(), e.getSceneY()));

代码示例来源:origin: stackoverflow.com

  1. byNode.setOnMouseDragged(new EventHandler<MouseEvent>() {
  2. @Override public void handle(MouseEvent mouseEvent) {
  3. stage.setX(mouseEvent.getScreenX() + dragDelta.x);

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void dispose() {
  6. _sprite.setOnMousePressed( null );
  7. _sprite.setOnMouseDragged( null );
  8. _sprite.setOnMouseReleased( null );
  9. _sprite = null;
  10. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeBottom() {
  2. this.resizeBottom = createBottomResize();
  3. this.resizeBottom.setManaged(false);
  4. getChildren().add(this.resizeBottom);
  5. ResizeHandler resizeHandler = new ResizeHandler(Location.BOTTOM);
  6. this.resizeBottom.setOnMousePressed(resizeHandler);
  7. this.resizeBottom.setOnMouseDragged(resizeHandler);
  8. this.resizeBottom.setOnMouseReleased(resizeHandler);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeTop() {
  2. this.resizeTop = createTopResize();
  3. this.resizeTop.setManaged(false);
  4. getChildren().add(this.resizeTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP);
  6. this.resizeTop.setOnMousePressed(h);
  7. this.resizeTop.setOnMouseDragged(h);
  8. this.resizeTop.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeCornerRightBottom() {
  2. this.resizeCornerRightBottom = createResizeCornerRightBottom();
  3. this.resizeCornerRightBottom.setManaged(false);
  4. getChildren().add(this.resizeCornerRightBottom);
  5. ResizeHandler h = new ResizeHandler(Location.BOTTOM, Location.RIGHT);
  6. this.resizeCornerRightBottom.setOnMousePressed(h);
  7. this.resizeCornerRightBottom.setOnMouseDragged(h);
  8. this.resizeCornerRightBottom.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeCornerRightTop() {
  2. this.resizeCornerRightTop = createResizeCornerRightTop();
  3. this.resizeCornerRightTop.setManaged(false);
  4. getChildren().add(this.resizeCornerRightTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP, Location.RIGHT);
  6. this.resizeCornerRightTop.setOnMousePressed(h);
  7. this.resizeCornerRightTop.setOnMouseDragged(h);
  8. this.resizeCornerRightTop.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeCornerLeftBottom() {
  2. this.resizeCornerLeftBottom = createResizeCornerLeftBottom();
  3. this.resizeCornerLeftBottom.setManaged(false);
  4. getChildren().add(this.resizeCornerLeftBottom);
  5. ResizeHandler h = new ResizeHandler(Location.BOTTOM, Location.LEFT);
  6. this.resizeCornerLeftBottom.setOnMousePressed(h);
  7. this.resizeCornerLeftBottom.setOnMouseDragged(h);
  8. this.resizeCornerLeftBottom.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeLeft() {
  2. this.resizeLeft = createLeftResize();
  3. this.resizeLeft.setManaged(false);
  4. getChildren().add(this.resizeLeft);
  5. ResizeHandler h = new ResizeHandler(Location.LEFT);
  6. this.resizeLeft.setOnMousePressed(h);
  7. this.resizeLeft.setOnMouseDragged(h);
  8. this.resizeLeft.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeCornerLeftTop() {
  2. this.resizeCornerLeftTop = createResizeCornerLeftTop();
  3. this.resizeCornerLeftTop.setManaged(false);
  4. getChildren().add(this.resizeCornerLeftTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP, Location.LEFT);
  6. this.resizeCornerLeftTop.setOnMousePressed(h);
  7. this.resizeCornerLeftTop.setOnMouseDragged(h);
  8. this.resizeCornerLeftTop.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeCornerRightBottom() {
  2. this.resizeCornerRightBottom = createResizeCornerRightBottom();
  3. this.resizeCornerRightBottom.setManaged(false);
  4. getChildren().add(this.resizeCornerRightBottom);
  5. ResizeHandler h = new ResizeHandler(Location.BOTTOM, Location.RIGHT);
  6. this.resizeCornerRightBottom.setOnMousePressed(h);
  7. this.resizeCornerRightBottom.setOnMouseDragged(h);
  8. this.resizeCornerRightBottom.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeCornerLeftBottom() {
  2. this.resizeCornerLeftBottom = createResizeCornerLeftBottom();
  3. this.resizeCornerLeftBottom.setManaged(false);
  4. getChildren().add(this.resizeCornerLeftBottom);
  5. ResizeHandler h = new ResizeHandler(Location.BOTTOM, Location.LEFT);
  6. this.resizeCornerLeftBottom.setOnMousePressed(h);
  7. this.resizeCornerLeftBottom.setOnMouseDragged(h);
  8. this.resizeCornerLeftBottom.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeCornerLeftTop() {
  2. this.resizeCornerLeftTop = createResizeCornerLeftTop();
  3. this.resizeCornerLeftTop.setManaged(false);
  4. getChildren().add(this.resizeCornerLeftTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP, Location.LEFT);
  6. this.resizeCornerLeftTop.setOnMousePressed(h);
  7. this.resizeCornerLeftTop.setOnMouseDragged(h);
  8. this.resizeCornerLeftTop.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeTop() {
  2. this.resizeTop = createTopResize();
  3. this.resizeTop.setManaged(false);
  4. getChildren().add(this.resizeTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP);
  6. this.resizeTop.setOnMousePressed(h);
  7. this.resizeTop.setOnMouseDragged(h);
  8. this.resizeTop.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void initResizeRight() {
  2. this.resizeRight = createRightResize();
  3. this.resizeRight.setManaged(false);
  4. getChildren().add(this.resizeRight);
  5. ResizeHandler h = new ResizeHandler(Location.RIGHT);
  6. this.resizeRight.setOnMousePressed(h);
  7. this.resizeRight.setOnMouseDragged(h);
  8. this.resizeRight.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeLeft() {
  2. this.resizeLeft = createLeftResize();
  3. this.resizeLeft.setManaged(false);
  4. getChildren().add(this.resizeLeft);
  5. ResizeHandler h = new ResizeHandler(Location.LEFT);
  6. this.resizeLeft.setOnMousePressed(h);
  7. this.resizeLeft.setOnMouseDragged(h);
  8. this.resizeLeft.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeRight() {
  2. this.resizeRight = createRightResize();
  3. this.resizeRight.setManaged(false);
  4. getChildren().add(this.resizeRight);
  5. ResizeHandler h = new ResizeHandler(Location.RIGHT);
  6. this.resizeRight.setOnMousePressed(h);
  7. this.resizeRight.setOnMouseDragged(h);
  8. this.resizeRight.setOnMouseReleased(h);
  9. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. private void initResizeCornerRightTop() {
  2. this.resizeCornerRightTop = createResizeCornerRightTop();
  3. this.resizeCornerRightTop.setManaged(false);
  4. getChildren().add(this.resizeCornerRightTop);
  5. ResizeHandler h = new ResizeHandler(Location.TOP, Location.RIGHT);
  6. this.resizeCornerRightTop.setOnMousePressed(h);
  7. this.resizeCornerRightTop.setOnMouseDragged(h);
  8. this.resizeCornerRightTop.setOnMouseReleased(h);
  9. }

相关文章

Node类方法