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

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

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

MouseEvent.getY介绍

暂无

代码示例

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

protected void initControlListeners() {
  // if the control got resized the overlay rect must be rest
  control.layoutBoundsProperty().addListener(observable -> resetRippler());
  if (getChildren().contains(control)) {
    control.boundsInParentProperty().addListener(observable -> resetRippler());
  }
  control.addEventHandler(MouseEvent.MOUSE_PRESSED,
    (event) -> createRipple(event.getX() + padding, event.getY() + padding));
  // create fade out transition for the ripple
  control.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> releaseRipple());
}

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

(int) t.getX() / (SQUARE_SIZE + 1), NUM_OF_COLUMNS - 1);
  int yIndex = clamp(0,
    (int) t.getY() / (SQUARE_SIZE + 1), NUM_OF_ROWS - 1);
  int index = xIndex + yIndex * NUM_OF_COLUMNS;
  colorPicker.setValue((Color) squares.get(index).rectangle.getFill());
});
addEventHandler(MouseEvent.MOUSE_RELEASED, t -> {
  if (colorPickerGrid.getBoundsInLocal().contains(t.getX(), t.getY())) {
    updateSelection(colorPicker.getValue());
    colorPicker.fireEvent(new ActionEvent());

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

/**
 * init mouse listeners on the control
 */
protected void initControlListeners() {
  // if the control got resized the overlay rect must be rest
  control.layoutBoundsProperty().addListener(observable -> resetRippler());
  if(getChildren().contains(control))
    control.boundsInParentProperty().addListener(observable -> resetRippler());
  control.addEventHandler(MouseEvent.MOUSE_PRESSED,
    (event) -> createRipple(event.getX(), event.getY()));
  // create fade out transition for the ripple
  control.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> releaseRipple());
}

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

double dy = event.getY() - centerY;
  double theta = Math.atan2(dy, dx);
  double x = centerX + huesRadius * Math.cos(theta);
huesCircleView.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> {
  double dx = event.getX() - centerX;
  double dy = event.getY() - centerY;
  double theta = Math.atan2(dy, dx);
  double x = centerX + huesRadius * Math.cos(theta);
    selectorTransition.stop();
  if (Math.pow(event.getX() - centerX, 2) + Math.pow(event.getY() - centerY, 2) < Math.pow(slRadius - 2, 2)) {
    selector.setTranslateX(event.getX() - selector.getPrefWidth() / 2);
    selector.setTranslateY(event.getY() - selector.getPrefHeight() / 2);
  } else {
    double dx = event.getX() - centerX;
    double dy = event.getY() - centerY;
    double theta = Math.atan2(dy, dx);
    double x = centerX + (slRadius - 2) * Math.cos(theta);
      Interpolator.EASE_BOTH),
    new KeyValue(selector.translateYProperty(),
      event.getY() - selector
        .getPrefHeight() / 2,
      Interpolator.EASE_BOTH)))) {{

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

double y = mouseEvent.getY();
if (contentPlaceHolder.getBorder() != null && contentPlaceHolder.getBorder().getStrokes().size() > 0) {
  double borderWidth = contentPlaceHolder.snappedLeftInset();

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

double dy = event.getY();
double shift = 9;
double theta = Math.atan2(dy, dx);

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

eventPoint = e.getX();
} else {
  eventPoint = e.getY();

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(MouseEvent e) {
    double delta = (isHorizontal() ? e.getX() : -e.getY()) - preDragPos;
    rangeSliderBehavior.moveRange(delta);
  }
});

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(MouseEvent e) {
    rangeBar.requestFocus();
    preDragPos = isHorizontal() ? e.getX() : -e.getY();
  }
});

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

/**
 * computes the text offset under the mouse cursor.
 *
 * @param event
 * @return the offset
 */
protected int computeCursorOffset(MouseEvent event) {
  return this.textArea.getOffsetAtPosition(event.getX(), event.getY());
}

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(javafx.scene.input.MouseEvent me) {
    if (!lowThumb.isPressed() && !highThumb.isPressed()) {
      if (isHorizontal()) {
        rangeSliderBehavior.trackPress(me, (me.getX() / trackLength));
      } else {
        rangeSliderBehavior.trackPress(me, (me.getY() / trackLength));
      }
    }
  }
});

代码示例来源:origin: org.fxmisc.richtext/richtextfx

private Result processPrimaryOnlyMouseDragged(MouseEvent e) {
  Point2D p = new Point2D(e.getX(), e.getY());
  if(view.getLayoutBounds().contains(p)) {
    dragTo(p);
  }
  view.setAutoScrollOnDragDesired(true);
  // autoScrollTo will be set in "continueOrStopAutoScroll(MouseEvent)"
  return Result.PROCEED;
}

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(javafx.scene.input.MouseEvent me) {
    Point2D cur = lowThumb.localToParent(me.getX(), me.getY());
    double dragPos = (isHorizontal())?
      cur.getX() - preDragThumbPoint.getX() : -(cur.getY() - preDragThumbPoint.getY());
    rangeSliderBehavior.lowThumbDragged(me, preDragPos + dragPos / trackLength);
  }
});

代码示例来源:origin: org.fxmisc.richtext/richtextfx

private void continueOrStopAutoScroll(MouseEvent e) {
  if (!view.isAutoScrollOnDragDesired()) {
    autoscrollTo.setValue(null); // stops auto-scroll
  }
  Point2D p = new Point2D(e.getX(), e.getY());
  if(view.getLayoutBounds().contains(p)) {
    autoscrollTo.setValue(null); // stops auto-scroll
  } else {
    autoscrollTo.setValue(p);    // starts auto-scroll
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(MouseEvent e) {
    lowThumb.setFocus(false);
    highThumb.setFocus(true);
    rangeSliderBehavior.highThumbPressed(e, 0.0D);
    preDragThumbPoint = highThumb.localToParent(e.getX(), e.getY());
    preDragPos = (((RangeSlider) getSkinnable()).getHighValue() - ((RangeSlider) getSkinnable()).getMin()) / 
          (getMaxMinusMinNoZero());
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(javafx.scene.input.MouseEvent me) {
    highThumb.setFocus(false);
    lowThumb.setFocus(true);
    rangeSliderBehavior.lowThumbPressed(me, 0.0f);
    preDragThumbPoint = lowThumb.localToParent(me.getX(), me.getY());
    preDragPos = (getSkinnable().getLowValue() - getSkinnable().getMin()) /
        (getMaxMinusMinNoZero());
  }
});

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(MouseEvent e) {
    boolean orientation = ((RangeSlider) getSkinnable()).getOrientation() == Orientation.HORIZONTAL;
    double trackLength = orientation ? track.getWidth() : track.getHeight();
    Point2D point2d = highThumb.localToParent(e.getX(), e.getY());
    double d = ((RangeSlider) getSkinnable()).getOrientation() != Orientation.HORIZONTAL ? -(point2d.getY() - preDragThumbPoint.getY()) : point2d.getX() - preDragThumbPoint.getX();
    rangeSliderBehavior.highThumbDragged(e, preDragPos + d / trackLength);
  }
});

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

protected void initControlListeners() {
  // if the control got resized the overlay rect must be rest
  control.layoutBoundsProperty().addListener(observable -> resetRippler());
  if (getChildren().contains(control)) {
    control.boundsInParentProperty().addListener(observable -> resetRippler());
  }
  control.addEventHandler(MouseEvent.MOUSE_PRESSED,
    (event) -> createRipple(event.getX() + padding, event.getY() + padding));
  // create fade out transition for the ripple
  control.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> releaseRipple());
}

代码示例来源:origin: org.gillius/jfxutils

@Override
  public void handle( MouseEvent event ) {
    if ( event.getClickCount() == 2 && event.getButton() == MouseButton.PRIMARY ) {
      double x = event.getX();
      double y = event.getY();
      if ( !chartInfo.getXAxisArea().contains( x, y ) )
        chartInfo.getChart().getYAxis().setAutoRanging( true );
      if ( !chartInfo.getYAxisArea().contains( x, y ) )
        chartInfo.getChart().getXAxis().setAutoRanging( true );
    }
  }
};

代码示例来源:origin: nl.cloudfarming.client/calendar-api

private void barClicked(MouseEvent event) {
  MouseButton mouseButton = event.getButton();
  if (MouseButton.PRIMARY.equals(mouseButton) && event.isControlDown()) {
    onBarClicked.handle(new BarEvent(node, BarEvent.ZOOM));
  } else if (MouseButton.PRIMARY.equals(mouseButton)) {
    if (bar.isInsideStateIcon(new Point2D(event.getX(), event.getY()))) {
      node.setExpanded(!node.isExpanded());
      onBarClicked.handle(new BarEvent(node, BarEvent.EXPAND));
    }
  }
}

相关文章