javafx.scene.input.MouseEvent.getScreenX()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(172)

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

MouseEvent.getScreenX介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

private void updateInitMouseValues(MouseEvent mouseEvent) {
  initStageX = primaryStage.getX();
  initStageY = primaryStage.getY();
  initWidth = primaryStage.getWidth();
  initHeight = primaryStage.getHeight();
  initX = mouseEvent.getScreenX();
  initY = mouseEvent.getScreenY();
  xOffset = mouseEvent.getSceneX();
  yOffset = mouseEvent.getSceneY();
}

代码示例来源:origin: jfoenixadmin/JFoenix

newX = mouseEvent.getScreenX();
newY = mouseEvent.getScreenY();
  primaryStage.setX(mouseEvent.getScreenX() - xOffset);
  primaryStage.setY(mouseEvent.getScreenY() - yOffset);
  mouseEvent.consume();

代码示例来源:origin: pmd/pmd

|| t.getButton() == MouseButton.PRIMARY && t.getClickCount() > 1) {
if (this.getSelectionModel().getSelectedItem() != null) {
  fullMenu.show(this, t.getScreenX(), t.getScreenY());
} else {
  smallMenu.show(this, t.getScreenX(), t.getScreenY());

代码示例来源:origin: speedment/speedment

menu.show(pane, event.getScreenX(), event.getScreenY());
} else if (menu.isShowing()) {
  menu.hide();

代码示例来源:origin: pmd/pmd

menu.show(xpathExpressionArea, t.getScreenX(), t.getScreenY());

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

bp.setOnMousePressed(new EventHandler<MouseEvent>() {
     @Override
     public void handle(MouseEvent event) {
       xOffset = primaryStage.getX() - event.getScreenX();
       yOffset = primaryStage.getY() - event.getScreenY();
     }
   });

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

bp.setOnMouseDragged(new EventHandler<MouseEvent>() {
     @Override
     public void handle(MouseEvent event) {
       primaryStage.setX(event.getScreenX() + xOffset);
       primaryStage.setY(event.getScreenY() + yOffset);
     }
   });

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

// allow the clock background to be used to drag the clock around.
final Delta dragDelta = new Delta();
layout.setOnMousePressed(new EventHandler<MouseEvent>() {
 @Override public void handle(MouseEvent mouseEvent) {
  // record a delta distance for the drag and drop operation.
  dragDelta.x = stage.getX() - mouseEvent.getScreenX();
  dragDelta.y = stage.getY() - mouseEvent.getScreenY();
 }
});
layout.setOnMouseDragged(new EventHandler<MouseEvent>() {
 @Override public void handle(MouseEvent mouseEvent) {
  stage.setX(mouseEvent.getScreenX() + dragDelta.x);
  stage.setY(mouseEvent.getScreenY() + dragDelta.y);
 }
});

...

// records relative x and y co-ordinates.
class Delta { double x, y; }

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

final AnchorPane pane = new AnchorPane();
// fill pane with nodes, etc
// create context menu and menu items as above
pane.setOnMousePressed(new EventHandler<MouseEvent>() {
  @Override
  public void handle(MouseEvent event) {
    if (event.isSecondaryButtonDown()) {
      contextMenu.show(pane, event.getScreenX(), event.getScreenY());
    }
  }
});

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

if (Cursor.NW_RESIZE.equals(cursorEvent) == true || Cursor.W_RESIZE.equals(cursorEvent) == true || Cursor.SW_RESIZE.equals(cursorEvent) == true) {
  if (stage.getWidth() > minWidth || mouseEventX < 0) {
    stage.setWidth(stage.getX() - mouseEvent.getScreenX() + stage.getWidth());
    stage.setX(mouseEvent.getScreenX());

代码示例来源:origin: eu.mihosoft.vrl.jcsg/jcsg

private double getCoord(MouseEvent t, Orientation orientation) {
  switch (orientation) {
    case HORIZONTAL:
      return t.getScreenX();
    case VERTICAL:
      return t.getScreenY();
    default:
      throw new IllegalArgumentException("This orientation is not supported: " + orientation);
  }
}

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

root.setOnMouseClicked(new EventHandler<MouseEvent>() 
{
 @Override
 public void handle(MouseEvent event) {
  System.out.println(event.getScreenX());
  System.out.println(event.getScreenY());
 }
});

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

obj.setOnMousePressed(new EventHandler<MouseEvent>() {
 @Override public void handle(MouseEvent mouseEvent) {
  // record a delta distance for the drag and drop operation.
  dragDelta.x = stage.getX() - mouseEvent.getScreenX();
  dragDelta.y = stage.getY() - mouseEvent.getScreenY();
 }
});
obj.setOnMouseDragged(new EventHandler<MouseEvent>() {
 @Override public void handle(MouseEvent mouseEvent) {
   stage.setX(mouseEvent.getScreenX() + dragDelta.x);
  stage.setY(mouseEvent.getScreenY() + dragDelta.y);
 }
});

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

source.setOnMouseDragged(new EventHandler<MouseEvent>() {
     @Override
     public void handle(MouseEvent event) {
       System.out.println("MouseScreenX:" + event.getScreenX() + ", MouseScreenY:" + event.getScreenY());
       System.out.println("MouseSceneX:" + event.getSceneX() + ", MouseSceneY:" + event.getSceneY());
       // Execute some code here(maybe it has to run in a different
       // Thread)
       // ...code
       // ....
     }
   });

代码示例来源:origin: org.jfxtras/jfxtras-menu

/**
 * 
 * @param mouseEvent
 */
public void show(MouseEvent mouseEvent) {
  show(mouseEvent.getScreenX(), mouseEvent.getScreenY());
}

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

protected EventHandler<MouseEvent> createContextMenuHandler(final ContextMenu contextMenu) {
  return (MouseEvent event) -> {
    // TODO: is this check for MouseButton.SECONDARY really necessary?
    if (event.getButton() == MouseButton.SECONDARY) {
      contextMenu.show(connectionPath,
          event.getScreenX(), event.getScreenY());
    }
  };
}

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

void handle_mouseDragged(MouseEvent e) {
  if( DRAGGED_TAB == null ) {
    return;
  }
  Node node = Util.findNode((Window)null, e.getScreenX(), e.getScreenY());
  if (node != null) {
    ((Stage)node.getScene().getWindow()).toFront();
    Event.fireEvent(node, new EFXDragEvent(this, node, EFXDragEvent.DRAG_OVER, e.getScreenX(),
            e.getScreenY(), false));
  } else {
    EFXDragEvent.updateFeedbackLocation(e.getScreenX(), e.getScreenY());
  }
}

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

public TextHoverEvent(MouseEvent source, List<HoverTarget> hoverTargets) {
  super(HOVER, source.getSceneX(), source.getSceneY(), source.getScreenX(), source.getScreenY(), source.getButton(), source.getClickCount(), source.isShiftDown(), source.isControlDown(), source.isAltDown(), source.isMetaDown(), source.isPrimaryButtonDown(), source.isMiddleButtonDown(),
      source.isSecondaryButtonDown(), source.isSynthesized(), source.isPopupTrigger(), source.isStillSincePress(), source.getPickResult());
  this.hoverTargets = Collections.unmodifiableList(hoverTargets);
  Optional<Range<Integer>> range = this.hoverTargets.stream().map(t->t.textRange).findFirst();
  // TODO remove me
  this.tokenText = null;
  this.offsetTokenStart = range.isPresent() ? range.get().lowerEndpoint() : 0;;
  this.offsetTokenEnd = range.isPresent() ? range.get().upperEndpoint() : 0;;
  this.offset = range.isPresent() ? range.get().lowerEndpoint() : 0;
}

代码示例来源:origin: com.jfoenix/jfoenix

private void updateInitMouseValues(MouseEvent mouseEvent) {
  initStageX = primaryStage.getX();
  initStageY = primaryStage.getY();
  initWidth = primaryStage.getWidth();
  initHeight = primaryStage.getHeight();
  initX = mouseEvent.getScreenX();
  initY = mouseEvent.getScreenY();
  xOffset = mouseEvent.getSceneX();
  yOffset = mouseEvent.getSceneY();
}

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

/**
 * Create a new text position event
 *
 * @param event
 *            the source mouse event
 * @param offset
 *            the offset in the text (might be -1 to indicate no valid
 *            region was found)
 */
public TextPositionEvent(MouseEvent event, int offset) {
  super(convert(event.getEventType()), event.getSceneX(), event.getSceneY(), event.getScreenX(), event.getScreenY(), event.getButton(), event.getClickCount(), event.isShiftDown(), event.isControlDown(), event.isAltDown(), event.isMetaDown(), event.isPrimaryButtonDown(), event.isMiddleButtonDown(),
      event.isSecondaryButtonDown(), event.isSynthesized(), event.isPopupTrigger(), event.isStillSincePress(), event.getPickResult());
  this.offset = offset;
}

相关文章