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

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

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

Rectangle.setY介绍

暂无

代码示例

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

public void layoutLines(double x, double y, double w, double h, double controlHeight, double translateY) {
  this.contentHeight = translateY;
  clip.setY(-contentHeight);
  clip.setHeight(controlHeight + contentHeight);
  focusedLine.resizeRelocate(x, controlHeight, w, focusedLine.prefHeight(-1));
  line.resizeRelocate(x, controlHeight, w, line.prefHeight(-1));
  promptContainer.resizeRelocate(x, y, w, h);
  scale.setPivotX(w / 2);
}

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

private void updateHeaderContainerClip() {
      final double clipOffset = getClipOffset();
      final Side side = getSkinnable().getSide();
      double controlPrefWidth = 2 * snapSize(rightControlButton.prefWidth(-1));
      // Add the spacer if the control buttons are shown
//            controlPrefWidth = controlPrefWidth > 0 ? controlPrefWidth + SPACER : controlPrefWidth;

      measureClosingTabs = true;
      final double headersPrefWidth = snapSize(headersRegion.prefWidth(-1));
      final double headersPrefHeight = snapSize(headersRegion.prefHeight(-1));
      measureClosingTabs = false;

      final double maxWidth = snapSize(getWidth()) - controlPrefWidth - clipOffset;
      final double clipWidth = headersPrefWidth < maxWidth ? headersPrefWidth : maxWidth;
      final double clipHeight = headersPrefHeight;

      clip.setX((side == Side.LEFT || side == Side.BOTTOM)
           && headersPrefWidth >= maxWidth ? headersPrefWidth - maxWidth : 0);
      clip.setY(0);
      clip.setWidth(clipWidth);
      clip.setHeight(clipHeight);
    }

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

clip.setY(gap / 2);
    clip.setHeight(getHeight() - gap);
    gapAnimation = new Timeline(new KeyFrame(Duration.millis(240),
    playExpandAnimation = false;
  } else if (selectionChanged) {
    clip.setY(0);
    clip.setHeight(getHeight());
    gapAnimation = new Timeline(
  clip.setY(gap / 2);
  clip.setHeight(getHeight() - gap);
clip.setY(0);
clip.setHeight(getHeight());

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

/**
 * Resized the specified rectangle so that its upper left point is {@code (0, 0)} and its width and height are
 * both 0.
 * 
 * @param rectangle
 *            the {@link Rectangle} which will be resized
 */
private static void resizeRectangleToZero(Rectangle rectangle) {
  rectangle.setX(0);
  rectangle.setY(0);
  rectangle.setWidth(0);
  rectangle.setHeight(0);
}

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

/**
 * Updates the position and size of {@link #selectedArea} (and by binding that of {@link #unselectedArea}) to the
 * specified arguments.
 * 
 * @param x
 *            the new x coordinate of the upper left corner
 * @param y
 *            the new y coordinate of the upper left corner
 * @param width
 *            the new width
 * @param height
 *            the new height
 */
private void setSelection(double x, double y, double width, double height) {
  selectedArea.setX(x);
  selectedArea.setY(y);
  selectedArea.setWidth(width);
  selectedArea.setHeight(height);
}

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

@Override protected void layoutChildren(double x, double y, double w, double h) {
  final double notificationBarHeight = notificationBar.prefHeight(w);
  
  notificationBar.resize(w, notificationBarHeight);
  
  // layout the content
  if (content != null) {
    content.resizeRelocate(x, y, w, h);
  }
  
  // and update the clip so that the notification bar does not draw outside
  // the bounds of the notification pane
  clip.setX(x);
  clip.setY(y);
  clip.setWidth(w);
  clip.setHeight(h);
}

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

public void layoutLines(double x, double y, double w, double h, double controlHeight, double translateY) {
  this.contentHeight = translateY;
  clip.setY(-contentHeight);
  clip.setHeight(controlHeight + contentHeight);
  focusedLine.resizeRelocate(x, controlHeight, w, focusedLine.prefHeight(-1));
  line.resizeRelocate(x, controlHeight, w, line.prefHeight(-1));
  promptContainer.resizeRelocate(x, y, w, h);
  scale.setPivotX(w / 2);
}

代码示例来源: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: ch.sahits.game/OpenPatricianJavaFX

private Shape createSegmentedShape(double width, double heigth, List<Integer> visibleSegments) {
   double segmentWidth = width/3;
   double segmentHeight = heigth/3;
   Shape shape = new Rectangle();
   for (Integer visibleSegment : visibleSegments) {
     Rectangle rect = new Rectangle();
     rect.setWidth(segmentWidth);
     rect.setHeight(segmentHeight);
     int row = (visibleSegment-1) / 3;
     int col = (visibleSegment-1) % 3;
     rect.setY(row * segmentHeight);
     rect.setX(col * segmentWidth);
     shape = Shape.union(shape, rect);
   }
   return shape;
 }

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

/**
 * Resized the specified rectangle so that it matches the specified bounds, i.e. it will have the same upper
 * left point and width and height.
 * 
 * @param rectangle
 *            the {@link Rectangle} which will be resized
 * @param bounds
 *            the {@link Bounds} to which the rectangle will be resized
 */
private static void resizeRectangleToBounds(Rectangle rectangle, Bounds bounds) {
  rectangle.setX(bounds.getMinX());
  rectangle.setY(bounds.getMinY());
  rectangle.setWidth(bounds.getWidth());
  rectangle.setHeight(bounds.getHeight());
}

代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer

@Override
  protected void layoutChildren() {
    double size = Math.min(getWidth(), getHeight());

    leg1.setStartX(size / 2);
    leg1.setStartY(size * MARGIN);
    leg1.setEndX(size / 2);
    leg1.setEndY(size * BOX_MARGIN);

    leg2.setStartX(size / 2);
    leg2.setStartY(size * (1 - MARGIN));
    leg2.setEndX(size / 2);
    leg2.setEndY(size * (1 - BOX_MARGIN));

    box.setX(size * BOX_MARGIN);
    box.setY(size * BOX_MARGIN);
    box.setWidth(size * (1 - 2 * BOX_MARGIN));
    box.setHeight(size * (1 - 2 * BOX_MARGIN));
  }
}

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

shadowRectangle.setHeight(h - SHADOW_WIDTH * 2);
 shadowRectangle.setX(SHADOW_WIDTH);
 shadowRectangle.setY(SHADOW_WIDTH);
} else if (node == backgroundRect) {
 backgroundRect.setWidth(w - SHADOW_WIDTH * 2);
 backgroundRect.setHeight(h - SHADOW_WIDTH * 2);
 backgroundRect.setX(SHADOW_WIDTH);
 backgroundRect.setY(SHADOW_WIDTH);
} else if (node == stageDecoration) {
 stageDecoration.resize(w - SHADOW_WIDTH * 2 - ROUNDED_DELTA * 2, h - SHADOW_WIDTH * 2 - ROUNDED_DELTA * 2);

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

(observable, oldValue, newValue) -> slaveClip.setY(newValue.doubleValue()));
clip.widthProperty().addListener((observable, oldValue, newValue) -> {
  slaveClip.setWidth(newValue.doubleValue());

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

@Override
protected void layoutChildren() {
  int space = 0;
  int w = 16;
  this.horizontal.resizeRelocate(0, getHeight() - w, getWidth() - w , w);
  this.vertical.resizeRelocate(getWidth() - w, 0, w, getHeight()- w);
  if (this.center != null) {
    this.clip.setX(0);
    this.clip.setY(0);
    this.clip.setWidth(getWidth() - w - space);
    this.clip.setHeight(getHeight() - w - space);
    this.center.resizeRelocate(0, 0, getWidth() - w - space, getHeight() - w - space);
  }
}

代码示例来源:origin: com.cedarsoft.commons/javafx

@SuppressWarnings("MethodDoesntCallSuperMethod")
@Override
protected void layoutChildren() {
 double width = getWidth();
 double height = getHeight();
 double labelPrefWidth = label.prefWidth(height);
 double labelPrefHeight = label.prefHeight(width);
 rectangle.setX(0);
 rectangle.setY(0);
 rectangle.setWidth(labelPrefWidth + 10);
 rectangle.setHeight(labelPrefHeight + 6);
 label.resizeRelocate(5, 3, labelPrefWidth, labelPrefHeight);
 line.setStartX(width / 2.0);
 line.setEndX(line.getStartX());
 line.setStartY(rectangle.getHeight());
 line.setEndY(height);
}

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

private void updateHeaderContainerClip() {
      final double clipOffset = getClipOffset();
      final Side side = getSkinnable().getSide();
      double controlPrefWidth = 2 * snapSize(rightControlButton.prefWidth(-1));
      // Add the spacer if the control buttons are shown
//            controlPrefWidth = controlPrefWidth > 0 ? controlPrefWidth + SPACER : controlPrefWidth;

      measureClosingTabs = true;
      final double headersPrefWidth = snapSize(headersRegion.prefWidth(-1));
      final double headersPrefHeight = snapSize(headersRegion.prefHeight(-1));
      measureClosingTabs = false;

      final double maxWidth = snapSize(getWidth()) - controlPrefWidth - clipOffset;
      final double clipWidth = headersPrefWidth < maxWidth ? headersPrefWidth : maxWidth;
      final double clipHeight = headersPrefHeight;

      clip.setX((side == Side.LEFT || side == Side.BOTTOM)
           && headersPrefWidth >= maxWidth ? headersPrefWidth - maxWidth : 0);
      clip.setY(0);
      clip.setWidth(clipWidth);
      clip.setHeight(clipHeight);
    }

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

clip.setY(gap / 2);
    clip.setHeight(getHeight() - gap);
    gapAnimation = new Timeline(new KeyFrame(Duration.millis(240),
    playExpandAnimation = false;
  } else if (selectionChanged) {
    clip.setY(0);
    clip.setHeight(getHeight());
    gapAnimation = new Timeline(
  clip.setY(gap / 2);
  clip.setHeight(getHeight() - gap);
clip.setY(0);
clip.setHeight(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);
}

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

/**
 * Activate dock feedback on screen's bounds
 *
 * @param x
 * @param y
 */
public void setDockFeedbackVisible(double x, double y, double width, double height) {
 dockFeedbackPopup.setX(x);
 dockFeedbackPopup.setY(y);
 dockFeedback.setX(SHADOW_WIDTH);
 dockFeedback.setY(SHADOW_WIDTH);
 dockFeedback.setHeight(height - SHADOW_WIDTH * 2);
 dockFeedback.setWidth(width - SHADOW_WIDTH * 2);
 dockFeedbackPopup.setWidth(width);
 dockFeedbackPopup.setHeight(height);
 dockFeedback.setOpacity(1);
 dockFeedbackPopup.show();
 dockFadeTransition = new FadeTransition();
 dockFadeTransition.setDuration(Duration.millis(200));
 dockFadeTransition.setNode(dockFeedback);
 dockFadeTransition.setFromValue(0);
 dockFadeTransition.setToValue(1);
 dockFadeTransition.setAutoReverse(true);
 dockFadeTransition.setCycleCount(3);
 dockFadeTransition.play();
}

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

clip.setY(0);
clip.widthProperty().bind(getSkinnable().widthProperty());
clip.heightProperty().bind(getSkinnable().heightProperty());

相关文章

微信公众号

最新文章

更多