javafx.scene.control.Label.setTranslateX()方法的使用及代码示例

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

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

Label.setTranslateX介绍

暂无

代码示例

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

/**
 * Create the labels and add them to the group.
 * @param g group the labels are added to
 * @param centerPoint central point around which the labels are placed.
 */
private void createAndAddLabels(Group g, final Point2D centerPoint) {
  List<String> values = control.valuesProperty();
  angles = new ArrayList<>(values.size());
  double angle = currentRotation.doubleValue() + 180;
  double step = (180.0 - 2 * currentRotation.doubleValue()) / (values.size() - 1);
  int radius = 120;
  for (String value : values) {
    angles.add(angle);
    Point2D basePoint = calculateBasePoint(centerPoint, radius, angle);
    Dimension2D dim = sizeing.calculate(value, control.getFont());
    Label l = new Label(value);
    l.setFont(control.getFont());
    l.getStyleClass().add("openPatricianSlider");
    l.setTranslateX(basePoint.getX() - dim.getWidth() * calculateMoveFactor(angle));
    l.setTranslateY(basePoint.getY() - dim.getHeight());
    g.getChildren().add(l);
    angle += step;
  }
  double initialAngle = Math.max(INITIAL_ROTATION, control.getSelectedIndex() * step);
  currentRotation.setValue(initialAngle);
}
/**

代码示例来源:origin: com.bitplan.radolan/com.bitplan.radolan

/**
 * draw a circle with given text on the given pane
 * 
 * @param pane
 * @param text
 * @param radius
 * @param color
 * @param x
 * @param y
 */
public static Circle drawCircleWithText(Pane pane, String text, double radius,
  Color color, double x, double y) {
 Circle circle = new Circle();
 circle.setRadius(radius);
 circle.setFill(color);
 circle.setTranslateX(x);
 circle.setTranslateY(y);

 Label label = new Label(text);
 label.setTranslateX(x + radius);
 label.setTranslateY(y + radius);
 label.setTextFill(color);
 pane.getChildren().addAll(circle, label);
 return circle;
}

代码示例来源:origin: com.github.almasb/fxgl-ui

barGroup.translateXProperty().bind(label.widthProperty().add(10));
barGroup.setTranslateY(0);
label.setTranslateX(0);
label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2)));
break;

代码示例来源:origin: com.github.almasb/fxgl-base

barGroup.translateXProperty().bind(label.widthProperty().add(10));
barGroup.setTranslateY(0);
label.setTranslateX(0);
label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2)));
break;

相关文章