javafx.scene.text.Text#setRotate ( )源码实例Demo

下面列出了javafx.scene.text.Text#setRotate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tilesfx   文件: RadarNodeChart.java
private void drawText() {
    final double CENTER_X      = 0.5 * width;
    final double CENTER_Y      = 0.5 * height;
    final int    NO_OF_SECTORS = getNoOfSectors();

    Font   font         = Fonts.latoRegular(0.035 * size);
    double radAngle     = RadarChartMode.SECTOR == getMode() ? Math.toRadians(180 + angleStep * 0.5) : Math.toRadians(180);
    double radAngleStep = Math.toRadians(angleStep);
    textGroup.getChildren().clear();
    for (int i = 0 ; i < NO_OF_SECTORS ; i++) {
        double r = size * 0.48;
        double x  = CENTER_X - size * 0.015 + (-Math.sin(radAngle) * r);
        double y  = CENTER_Y + (+Math.cos(radAngle) * r);

        Text text = new Text(data.get(i).getName());
        text.setFont(font);
        text.setFill(data.get(i).getTextColor());
        text.setTextOrigin(VPos.CENTER);
        text.setTextAlignment(TextAlignment.CENTER);
        text.setRotate(Math.toDegrees(radAngle) - 180);
        text.setX(x);
        text.setY(y);
        textGroup.getChildren().add(text);
        radAngle += radAngleStep;
    }
}
 
源代码2 项目: phoenicis   文件: AbstractStepRepresentation.java
protected void drawLeftImage() {
    AnchorPane pane = new AnchorPane();
    pane.setPrefWidth(187);
    Stop[] stops = new Stop[] { new Stop(0, Color.web("#3c79b2")), new Stop(1, Color.web("#2d5d8b")) };
    RadialGradient gradient = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, stops);

    Background background = new Background(new BackgroundFill(gradient, null, null));
    pane.setBackground(background);

    Text text = new Text(this.parent.getLeftImageText());
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Maven Pro", 50));
    text.setRotate(-90);
    pane.setPadding(new Insets(-50));
    pane.getChildren().add(text);
    AnchorPane.setBottomAnchor(text, 160.0);
    AnchorPane.setRightAnchor(text, -40.0);

    getParent().getRoot().setLeft(pane);
}
 
源代码3 项目: mzmine3   文件: Fx3DStageController.java
private void setMzAxis() {
  axes.getMzAxisLabels().getChildren().clear();
  axes.getMzAxisTicks().getChildren().clear();
  double mzDelta = (mzRange.upperEndpoint() - mzRange.lowerEndpoint()) / 7;
  double mzScaleValue = mzRange.lowerEndpoint();
  Text mzLabel = new Text("m/z");
  mzLabel.setRotationAxis(Rotate.X_AXIS);
  mzLabel.setRotate(-45);
  mzLabel.setTranslateX(SIZE / 2);
  mzLabel.setTranslateZ(-5);
  mzLabel.setTranslateY(8);
  axes.getMzAxisLabels().getChildren().add(mzLabel);
  for (int y = 0; y <= SIZE; y += SIZE / 7) {
    Line tickLineZ = new Line(0, 0, 0, 9);
    tickLineZ.setRotationAxis(Rotate.X_AXIS);
    tickLineZ.setRotate(-90);
    tickLineZ.setTranslateY(-4);
    tickLineZ.setTranslateX(y - 2);
    float roundOff = (float) (Math.round(mzScaleValue * 100.0) / 100.0);
    Text text = new Text("" + roundOff);
    text.setRotationAxis(Rotate.X_AXIS);
    text.setRotate(-45);
    text.setTranslateY(8);
    text.setTranslateX(y - 10);
    text.setTranslateZ(20);
    mzScaleValue += mzDelta;
    axes.getMzAxisTicks().getChildren().add(tickLineZ);
    axes.getMzAxisLabels().getChildren().add(text);
  }
  axes.getMzAxisLabels().setRotate(270);
  axes.getMzAxisLabels().setTranslateX(SIZE / 2 + SIZE / 30);
  axes.getMzAxisTicks().setTranslateX(SIZE / 2 + 10);
  axes.getMzAxisTicks().setTranslateY(-1);
  axes.getMzAxis().setTranslateX(SIZE);
}
 
源代码4 项目: mzmine3   文件: Fx3DStageController.java
private void setRtAxis() {
  axes.getRtAxis().getChildren().clear();
  double rtDelta = (rtRange.upperEndpoint() - rtRange.lowerEndpoint()) / 7;
  double rtScaleValue = rtRange.upperEndpoint();
  Text rtLabel = new Text("Retention Time");
  rtLabel.setRotationAxis(Rotate.X_AXIS);
  rtLabel.setRotate(-45);
  rtLabel.setTranslateX(SIZE * 3 / 8);
  rtLabel.setTranslateZ(-25);
  rtLabel.setTranslateY(13);
  axes.getRtAxis().getChildren().add(rtLabel);
  for (int y = 0; y <= SIZE; y += SIZE / 7) {
    Line tickLineX = new Line(0, 0, 0, 9);
    tickLineX.setRotationAxis(Rotate.X_AXIS);
    tickLineX.setRotate(-90);
    tickLineX.setTranslateY(-5);
    tickLineX.setTranslateX(y);
    tickLineX.setTranslateZ(-3.5);
    float roundOff = (float) (Math.round(rtScaleValue * 10.0) / 10.0);
    Text text = new Text("" + roundOff);
    text.setRotationAxis(Rotate.X_AXIS);
    text.setRotate(-45);
    text.setTranslateY(9);
    text.setTranslateX(y - 5);
    text.setTranslateZ(-15);
    rtScaleValue -= rtDelta;
    axes.getRtAxis().getChildren().addAll(text, tickLineX);
  }
  Line lineX = new Line(0, 0, SIZE, 0);
  axes.getRtAxis().getChildren().add(lineX);
  axes.getRtRotate().setAngle(180);
  axes.getRtTranslate().setZ(-SIZE);
  axes.getRtTranslate().setX(-SIZE);
}
 
源代码5 项目: mzmine2   文件: Fx3DStageController.java
private void setMzAxis() {
    axes.getMzAxisLabels().getChildren().clear();
    axes.getMzAxisTicks().getChildren().clear();
    double mzDelta = (mzRange.upperEndpoint() - mzRange.lowerEndpoint())
            / 7;
    double mzScaleValue = mzRange.lowerEndpoint();
    Text mzLabel = new Text("m/z");
    mzLabel.setRotationAxis(Rotate.X_AXIS);
    mzLabel.setRotate(-45);
    mzLabel.setTranslateX(SIZE / 2);
    mzLabel.setTranslateZ(-5);
    mzLabel.setTranslateY(8);
    axes.getMzAxisLabels().getChildren().add(mzLabel);
    for (int y = 0; y <= SIZE; y += SIZE / 7) {
        Line tickLineZ = new Line(0, 0, 0, 9);
        tickLineZ.setRotationAxis(Rotate.X_AXIS);
        tickLineZ.setRotate(-90);
        tickLineZ.setTranslateY(-4);
        tickLineZ.setTranslateX(y - 2);
        float roundOff = (float) (Math.round(mzScaleValue * 100.0) / 100.0);
        Text text = new Text("" + (float) roundOff);
        text.setRotationAxis(Rotate.X_AXIS);
        text.setRotate(-45);
        text.setTranslateY(8);
        text.setTranslateX(y - 10);
        text.setTranslateZ(20);
        mzScaleValue += mzDelta;
        axes.getMzAxisTicks().getChildren().add(tickLineZ);
        axes.getMzAxisLabels().getChildren().add(text);
    }
    axes.getMzAxisLabels().setRotate(270);
    axes.getMzAxisLabels().setTranslateX(SIZE / 2 + SIZE / 30);
    axes.getMzAxisTicks().setTranslateX(SIZE / 2 + 10);
    axes.getMzAxisTicks().setTranslateY(-1);
    axes.getMzAxis().setTranslateX(SIZE);
}
 
源代码6 项目: mzmine2   文件: Fx3DStageController.java
private void setRtAxis() {
    axes.getRtAxis().getChildren().clear();
    double rtDelta = (rtRange.upperEndpoint() - rtRange.lowerEndpoint())
            / 7;
    double rtScaleValue = rtRange.upperEndpoint();
    Text rtLabel = new Text("Retention Time");
    rtLabel.setRotationAxis(Rotate.X_AXIS);
    rtLabel.setRotate(-45);
    rtLabel.setTranslateX(SIZE * 3 / 8);
    rtLabel.setTranslateZ(-25);
    rtLabel.setTranslateY(13);
    axes.getRtAxis().getChildren().add(rtLabel);
    for (int y = 0; y <= SIZE; y += SIZE / 7) {
        Line tickLineX = new Line(0, 0, 0, 9);
        tickLineX.setRotationAxis(Rotate.X_AXIS);
        tickLineX.setRotate(-90);
        tickLineX.setTranslateY(-5);
        tickLineX.setTranslateX(y);
        tickLineX.setTranslateZ(-3.5);
        float roundOff = (float) (Math.round(rtScaleValue * 10.0) / 10.0);
        Text text = new Text("" + (float) roundOff);
        text.setRotationAxis(Rotate.X_AXIS);
        text.setRotate(-45);
        text.setTranslateY(9);
        text.setTranslateX(y - 5);
        text.setTranslateZ(-15);
        rtScaleValue -= rtDelta;
        axes.getRtAxis().getChildren().addAll(text, tickLineX);
    }
    Line lineX = new Line(0, 0, SIZE, 0);
    axes.getRtAxis().getChildren().add(lineX);
    axes.getRtRotate().setAngle(180);
    axes.getRtTranslate().setZ(-SIZE);
    axes.getRtTranslate().setX(-SIZE);
}
 
源代码7 项目: regulators   文件: ColorRegulator.java
private void initGraphics() {
    dropShadow  = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);

    Stop[] stops = { new Stop(0.0, Color.rgb(255,255,0)),
                     new Stop(0.125, Color.rgb(255,0,0)),
                     new Stop(0.375, Color.rgb(255,0,255)),
                     new Stop(0.5, Color.rgb(0,0,255)),
                     new Stop(0.625, Color.rgb(0,255,255)),
                     new Stop(0.875, Color.rgb(0,255,0)),
                     new Stop(1.0, Color.rgb(255,255,0)) };

    List<Stop> reorderedStops = reorderStops(stops);

    gradientLookup = new GradientLookup(stops);

    barGradient = new ConicalGradient(reorderedStops);
    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));

    buttonOn = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -125, 34.75);
    buttonOn.setFill(null);
    buttonOn.setStroke(color.get());
    buttonOn.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOn.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOn.setEffect(dropShadow);

    buttonOff = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -89.75, 34.75);
    buttonOff.setFill(null);
    buttonOff.setStroke(color.get());
    buttonOff.setStrokeLineCap(StrokeLineCap.BUTT);
    buttonOff.setStrokeWidth(PREFERRED_WIDTH * 0.072);
    buttonOff.setEffect(dropShadow);

    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42),
                          new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.setFill(color.get());
    ring.setEffect(highlight);

    mainCircle = new Circle();
    mainCircle.setFill(color.get().darker().darker());

    textOn = new Text("ON");
    textOn.setFill(textColor.get());
    textOn.setTextOrigin(VPos.CENTER);
    textOn.setMouseTransparent(true);
    textOn.setRotate(17);

    textOff = new Text("OFF");
    textOff.setFill(textColor.get());
    textOff.setTextOrigin(VPos.CENTER);
    textOff.setMouseTransparent(true);
    textOff.setRotate(-17);

    indicatorRotate = new Rotate(-ANGLE_RANGE *  0.5, center, center);

    indicatorGlow        = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorHighlight.setInput(indicatorInnerShadow);

    indicator = new Circle();
    indicator.setFill(color.get().darker());
    indicator.setStroke(color.get().darker().darker());
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);

    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);

    innerRing = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.24),
                               new Circle(center, center, PREFERRED_WIDTH * 0.2));
    innerRing.setFill(color.get());

    currentColorCircle = new Circle();
    currentColorCircle.setFill(targetColor.get());
    currentColorCircle.setVisible(isOn());

    pane = new Pane(barArc, ring, mainCircle, currentColorCircle, innerRing, indicatorGroup, buttonOn, textOn, buttonOff, textOff);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setEffect(highlight);

    getChildren().setAll(pane);
}