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

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

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

Rectangle.setWidth介绍

暂无

代码示例

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

/**
 * update the size of error container and its clip
 *
 * @param w
 * @param errorContainerHeight
 */
private void updateErrorContainerSize(double w, double errorContainerHeight) {
  errorContainerClip.setWidth(w);
  errorContainerClip.setHeight(errorContainerHeight);
  resize(w, errorContainerHeight);
}

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

@Override
protected void setOverLayBounds(Rectangle overlay) {
  overlay.setWidth(ripplerPane.getWidth());
  overlay.setHeight(ripplerPane.getHeight());
}

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

protected void setOverLayBounds(Rectangle overlay){
  overlay.setWidth(control.getLayoutBounds().getWidth());
  overlay.setHeight(control.getLayoutBounds().getHeight());
}

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

@Override
protected void handleControlPropertyChanged(String property) {
  super.handleControlPropertyChanged(property);
  if ("SELECTED_TAB".equals(property)) {
    isSelectingTab = true;
    selectedTab = getSkinnable().getSelectionModel().getSelectedItem();
    getSkinnable().requestLayout();
  } else if ("WIDTH".equals(property)) {
    clip.setWidth(getSkinnable().getWidth());
  } else if ("HEIGHT".equals(property)) {
    clip.setHeight(getSkinnable().getHeight());
  }
}

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

public void layoutPane(final double x, final double y, final double w, final double h) {
  relocate(x, y);
  // resize error container if animation is disabled
  if (control.isDisableAnimation() || isErrorVisible()) {
    resize(w, computeErrorHeight(computeErrorWidth(w)));
    errorContainerClip.setWidth(w);
  }
}

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

public void invalid(double w) {
  final ValidatorBase activeValidator = control.getActiveValidator();
  if (activeValidator != null) {
    showError(activeValidator);
    final double errorContainerWidth = w - errorIcon.prefWidth(-1);
    setOpacity(1);
    resize(w, computeErrorHeight(errorContainerWidth));
    errorContainerClip.setWidth(w);
    errorContainerClip.setHeight(getHeight());
    errorClipScale.setY(1);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
  final double strokeWidth = arc.getStrokeWidth();
  final double radius = Math.min(contentWidth, contentHeight) / 2 - strokeWidth / 2;
  final double arcSize = snapSize(radius * 2 + strokeWidth);
  arcPane.resizeRelocate((contentWidth - arcSize) / 2 + 1, (contentHeight - arcSize) / 2 + 1, arcSize, arcSize);
  updateArcLayout(radius, arcSize);
  fillRect.setWidth(arcSize);
  fillRect.setHeight(arcSize);
  if (!isValid) {
    initialize();
    isValid = true;
  }
  if (!getSkinnable().isIndeterminate()) {
    arc.setLength(arcLength);
    if (text.isVisible()) {
      final double progress = control.getProgress();
      int intProgress = (int) Math.round(progress * 100.0);
      Font font = text.getFont();
      text.setFont(Font.font(font.getFamily(), radius / 1.7));
      text.setText((progress > 1 ? 100 : intProgress) + "%");
      text.relocate((arcSize - text.getLayoutBounds().getWidth()) / 2, (arcSize - text.getLayoutBounds().getHeight()) / 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

tabsClip.setWidth(contentWidth);
tabsClip.setHeight(contentHeight);
tabsContainerHolder.resize(contentWidth, contentHeight);
  tabContentHolder.setTranslateX(contentWidth * i);
  if (tabContentHolder.getClip() != null) {
    ((Rectangle) tabContentHolder.getClip()).setWidth(contentWidth);
    ((Rectangle) tabContentHolder.getClip()).setHeight(contentHeight);

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

clip.setWidth(getWidth());

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

/**
 * update the size of error container and its clip
 *
 * @param w
 * @param errorContainerHeight
 */
private void updateErrorContainerSize(double w, double errorContainerHeight) {
  errorContainerClip.setWidth(w);
  errorContainerClip.setHeight(errorContainerHeight);
  resize(w, errorContainerHeight);
}

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

public void setCount(int count) {
    text.setText(Integer.toString(count));
    double height = text.getBoundsInLocal().getHeight();
    double width = Math.max(text.getBoundsInLocal().getWidth(), height);
    r1.setWidth(width * 1.3);
    r1.setHeight(height * 1.3);
    r2.setWidth(width * 1.2);
    r2.setHeight(height * 1.2);
  }
}

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

@Override
protected void setOverLayBounds(Rectangle overlay) {
  overlay.setWidth(ripplerPane.getWidth());
  overlay.setHeight(ripplerPane.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: com.jfoenix/jfoenix

protected void setOverLayBounds(Rectangle overlay){
  overlay.setWidth(control.getLayoutBounds().getWidth());
  overlay.setHeight(control.getLayoutBounds().getHeight());
}

代码示例来源: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 layoutPane(final double x, final double y, final double w, final double h) {
  relocate(x, y);
  // resize error container if animation is disabled
  if (control.isDisableAnimation() || isErrorVisible()) {
    resize(w, computeErrorHeight(computeErrorWidth(w)));
    errorContainerClip.setWidth(w);
  }
}

代码示例来源: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: com.jfoenix/jfoenix

public void invalid(double w) {
  final ValidatorBase activeValidator = control.getActiveValidator();
  if (activeValidator != null) {
    showError(activeValidator);
    final double errorContainerWidth = w - errorIcon.prefWidth(-1);
    setOpacity(1);
    resize(w, computeErrorHeight(errorContainerWidth));
    errorContainerClip.setWidth(w);
    errorContainerClip.setHeight(getHeight());
    errorClipScale.setY(1);
  }
}

代码示例来源: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);
  }
}

相关文章

微信公众号

最新文章

更多