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

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

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

Rectangle.setVisible介绍

暂无

代码示例

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

@Override
public void start(Stage primaryStage) {
  Rectangle rect = new Rectangle(100, 100, Color.LIME);

  VBox root = new VBox(new Rectangle(100, 100, Color.RED),
             rect,
             new Rectangle(100, 100, Color.BLUE));

  Scene scene = new Scene(root, 200, 300);
  scene.setOnMouseClicked(evt -> {
    rect.setManaged(!rect.isManaged());
    rect.setVisible(!rect.isVisible());
  });

  primaryStage.setScene(scene);
  primaryStage.show();
}

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

public void performDrag(
    Parent root, MouseEvent event) {
  rectangle.setVisible(true);
  final double parentScaleX = root.
      localToSceneTransformProperty().getValue().getMxx();
  final double parentScaleY = root.
      localToSceneTransformProperty().getValue().getMyy();
  final double translateX = -root.
      localToSceneTransformProperty().getValue().getTx();
  final double translateY = -root.
      localToSceneTransformProperty().getValue().getTy();
  secondX = event.getSceneX();
  secondY = event.getSceneY();
  firstX = Math.max(firstX, 0);
  firstY = Math.max(firstY, 0);
  secondX = Math.max(secondX, 0);
  secondY = Math.max(secondY, 0);
  double x = Math.min(firstX, secondX);
  double y = Math.min(firstY, secondY);
  double width = Math.abs(secondX - firstX);
  double height = Math.abs(secondY - firstY);
  rectangle.setX(x / parentScaleX + translateX / parentScaleX);
  rectangle.setY(y / parentScaleY + translateY / parentScaleY);
  rectangle.setWidth(width / parentScaleX);
  rectangle.setHeight(height / parentScaleY);
  selectIntersectingNodes(root, !event.isControlDown());
}

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

public void performDragBegin(
    Parent root, MouseEvent event) {
  selectedNodes.addAll(
      WindowUtil.getDefaultClipboard().getSelectedItems());
  if (rectangle.getParent() != null) {
    return;
  }
  // record the current mouse X and Y position on Node
  firstX = event.getSceneX();
  firstY = event.getSceneY();
  NodeUtil.addToParent(root, rectangle);
  rectangle.setWidth(0);
  rectangle.setHeight(0);
  rectangle.toFront();
  rectangle.setVisible(false);
}

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

shadowRectangle.layoutBoundsProperty().addListener((ChangeListener<Bounds>) (observable, oldBounds, newBounds) -> {
 if (SHADOW_WIDTH != 0) {
  shadowRectangle.setVisible(true);
  setShadowClip(newBounds);
 } else {
  shadowRectangle.setVisible(false);

相关文章

微信公众号

最新文章

更多