javafx.scene.shape.Rectangle.relocate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(90)

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

Rectangle.relocate介绍

暂无

代码示例

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

canvas.setPrefSize(200,200);
Rectangle rectangle = new Rectangle(100,100,Color.RED);
rectangle.relocate(70,70);
canvas.getChildren().add(rectangle);
canvas.setOnMousePressed(MousePressedEventHandler);

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

private void updateClip() {
  final Rating control = getSkinnable();
  final double h = control.getHeight() - (snappedTopInset() + snappedBottomInset());
  final double w = control.getWidth() - (snappedLeftInset() + snappedRightInset());
  
  if (isVertical()) {
    final double y = h * rating / control.getMax() ;
    forgroundClipRect.relocate(0, h - y);
    forgroundClipRect.setWidth(control.getWidth());
    forgroundClipRect.setHeight(y);
  } else {
    final double x = w * rating / control.getMax();        	
    forgroundClipRect.setWidth(x);
    forgroundClipRect.setHeight(control.getHeight());
  }
  
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Compute the needed clip for stage's shadow border
 *
 * @param newBounds
 * @param shadowVisible
 */
void setShadowClip(Bounds newBounds) {
 external.relocate(newBounds.getMinX() - SHADOW_WIDTH, newBounds.getMinY() - SHADOW_WIDTH);
 internal.setX(SHADOW_WIDTH);
 internal.setY(SHADOW_WIDTH);
 internal.setWidth(newBounds.getWidth());
 internal.setHeight(newBounds.getHeight());
 internal.setArcWidth(shadowRectangle.getArcWidth()); // shadowRectangle
 // CSS cannot be
 // applied on
 // this
 internal.setArcHeight(shadowRectangle.getArcHeight());
 external.setWidth(newBounds.getWidth() + SHADOW_WIDTH * 2);
 external.setHeight(newBounds.getHeight() + SHADOW_WIDTH * 2);
 Shape clip = Shape.subtract(external, internal);
 shadowRectangle.setClip(clip);
}

相关文章

微信公众号

最新文章

更多