Java Code Examples for javafx.scene.control.Tooltip#setTextAlignment()

The following examples show how to use javafx.scene.control.Tooltip#setTextAlignment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndicatorSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionLayer.getChildren().clear();

    double    centerX     = width * 0.5;
    double    centerY     = height * 0.85;
    double    barRadius   = height * 0.54210526;
    double    barWidth    = width * 0.28472222;
    List<Arc> sectionBars = new ArrayList<>(sections.size());
    for (Section section : sections) {
        Arc sectionBar = new Arc(centerX, centerY, barRadius, barRadius, angleRange * 0.5 + 90 - (section.getStart() * angleStep), -((section.getStop() - section.getStart()) - minValue) * angleStep);
        sectionBar.setType(ArcType.OPEN);
        sectionBar.setStroke(section.getColor());
        sectionBar.setStrokeWidth(barWidth);
        sectionBar.setStrokeLineCap(StrokeLineCap.BUTT);
        sectionBar.setFill(null);
        Tooltip sectionTooltip = new Tooltip(new StringBuilder(section.getText()).append("\n").append(String.format(Locale.US, "%.2f", section.getStart())).append(" - ").append(String.format(Locale.US, "%.2f", section.getStop())).toString());
        sectionTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(sectionBar, sectionTooltip);
        sectionBars.add(sectionBar);
    }
    sectionLayer.getChildren().addAll(sectionBars);
}
 
Example 2
Source File: LevelSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public LevelSkin(Gauge gauge) {
    super(gauge);
    locale               = gauge.getLocale();
    sections             = gauge.getSections();
    barTooltip           = new Tooltip();
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f%%").toString();
    currentValueListener = o -> setBar(gauge.getCurrentValue());
    barTooltip.setTextAlignment(TextAlignment.CENTER);

    initGraphics();
    registerListeners();
}
 
Example 3
Source File: CustomPlainAmpSkin.java    From medusademo with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections       = ticksAndSectionsCanvas.getGraphicsContext2D();

    ledCanvas = new Canvas();
    led       = ledCanvas.getGraphicsContext2D();

    thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")");
    thresholdTooltip.setTextAlignment(TextAlignment.CENTER);

    threshold = new Path();
    Helper.enableNode(threshold, gauge.isThresholdVisible());
    Tooltip.install(threshold, thresholdTooltip);

    average = new Path();
    Helper.enableNode(average, gauge.isAverageVisible());

    markerPane = new Pane();

    needleRotate = new Rotate(180 - START_ANGLE);
    needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep);

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleLineTo5       = new LineTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleClosePath7    = new ClosePath();
    needle              = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.getStyleClass().add("needle");

    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

    shadowGroup = new Group(needle);
    shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null);
    shadowGroup.getStyleClass().add("shadow-group");

    unitText = new Text(gauge.getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.getStyleClass().add("unit");

    lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT);
    lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT);
    lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT);
    lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.66 * PREFERRED_HEIGHT);
    lcd.getStyleClass().add("lcd");
    Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible());

    lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue()));
    lcdText.setAlignment(Pos.CENTER_RIGHT);
    lcdText.setVisible(gauge.isValueVisible());
    lcdText.getStyleClass().add("lcd-foreground");

    // Set initial value
    angleStep          = ANGLE_RANGE / gauge.getRange();
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
    targetAngle        = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle);
    needleRotate.setAngle(targetAngle);

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas,
                              markerPane,
                              ledCanvas,
                              unitText,
                              lcd,
                              lcdText,
                              shadowGroup);
    pane.getStyleClass().add("background-pane");

    getChildren().setAll(pane);
}
 
Example 4
Source File: PlainAmpSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections       = ticksAndSectionsCanvas.getGraphicsContext2D();

    ledCanvas = new Canvas();
    led       = ledCanvas.getGraphicsContext2D();

    thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")");
    thresholdTooltip.setTextAlignment(TextAlignment.CENTER);

    threshold = new Path();
    Helper.enableNode(threshold, gauge.isThresholdVisible());
    Tooltip.install(threshold, thresholdTooltip);

    average = new Path();
    Helper.enableNode(average, gauge.isAverageVisible());

    markerPane = new Pane();

    needleRotate = new Rotate(180 - START_ANGLE);
    needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep);

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleLineTo5       = new LineTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleClosePath7    = new ClosePath();
    needle              = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);

    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

    shadowGroup = new Group(needle);
    shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null);

    unitText = new Text(gauge.getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);

    lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT);
    lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT);
    lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT);
    lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.66 * PREFERRED_HEIGHT);
    Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible());

    lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue()));
    lcdText.setAlignment(Pos.CENTER_RIGHT);
    lcdText.setVisible(gauge.isValueVisible());

    // Set initial value
    angleStep          = ANGLE_RANGE / gauge.getRange();
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
    targetAngle        = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle);
    needleRotate.setAngle(targetAngle);

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas,
                              markerPane,
                              ledCanvas,
                              unitText,
                              lcd,
                              lcdText,
                              shadowGroup);

    getChildren().setAll(pane);
}
 
Example 5
Source File: AmpSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections       = ticksAndSectionsCanvas.getGraphicsContext2D();

    ledCanvas = new Canvas();
    led       = ledCanvas.getGraphicsContext2D();

    thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")");
    thresholdTooltip.setTextAlignment(TextAlignment.CENTER);

    threshold = new Path();
    Helper.enableNode(threshold, gauge.isThresholdVisible());
    Tooltip.install(threshold, thresholdTooltip);

    average = new Path();
    Helper.enableNode(average, gauge.isAverageVisible());

    markerPane = new Pane();

    needleRotate = new Rotate(180 - START_ANGLE);
    needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep);

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleLineTo5       = new LineTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleClosePath7    = new ClosePath();
    needle              = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);

    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

    shadowGroup = new Group(needle);
    shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null);

    titleText = new Text(gauge.getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    unitText = new Text(gauge.getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);

    lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT);
    lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT);
    lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT);
    lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.44 * PREFERRED_HEIGHT);
    Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible());

    lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue()));
    lcdText.setAlignment(Pos.CENTER_RIGHT);
    lcdText.setVisible(gauge.isValueVisible());

    // Set initial value
    angleStep          = ANGLE_RANGE / gauge.getRange();
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
    targetAngle        = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle);
    needleRotate.setAngle(targetAngle);

    lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0.0, 0.0, 2.0);

    foreground = new SVGPath();
    foreground.setContent("M 26 26.5 C 26 20.2432 26.2432 20 32.5 20 L 277.5 20 C 283.7568 20 284 20.2432 284 26.5 L 284 143.5 C 284 149.7568 283.7568 150 277.5 150 L 32.5 150 C 26.2432 150 26 149.7568 26 143.5 L 26 26.5 ZM 0 6.7241 L 0 253.2758 C 0 260 0 260 6.75 260 L 303.25 260 C 310 260 310 260 310 253.2758 L 310 6.7241 C 310 0 310 0 303.25 0 L 6.75 0 C 0 0 0 0 0 6.7241 Z");
    foreground.setEffect(lightEffect);

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas,
                              markerPane,
                              ledCanvas,
                              unitText,
                              lcd,
                              lcdText,
                              shadowGroup,
                              foreground,
                              titleText);

    getChildren().setAll(pane);
}
 
Example 6
Source File: TinySkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, ANGLE_RANGE * 0.5 + 90, -ANGLE_RANGE);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionCtx    = sectionCanvas.getGraphicsContext2D();

    needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep);

    needleMoveTo1        = new MoveTo();
    needleCubicCurveTo2  = new CubicCurveTo();
    needleCubicCurveTo3  = new CubicCurveTo();
    needleCubicCurveTo4  = new CubicCurveTo();
    needleCubicCurveTo5  = new CubicCurveTo();
    needleClosePath6     = new ClosePath();
    needleMoveTo7        = new MoveTo();
    needleCubicCurveTo8  = new CubicCurveTo();
    needleCubicCurveTo9  = new CubicCurveTo();
    needleCubicCurveTo10 = new CubicCurveTo();
    needleCubicCurveTo11 = new CubicCurveTo();
    needleClosePath12    = new ClosePath();
    needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleClosePath6,
                      needleMoveTo7, needleCubicCurveTo8, needleCubicCurveTo9, needleCubicCurveTo10, needleCubicCurveTo11, needleClosePath12);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setStrokeType(StrokeType.INSIDE);
    needle.setStrokeWidth(1);
    needle.setStroke(gauge.getBackgroundPaint());

    needleTooltip = new Tooltip(String.format(locale, formatString, gauge.getValue()));
    needleTooltip.setTextAlignment(TextAlignment.CENTER);
    Tooltip.install(needle, needleTooltip);

    pane = new Pane(barBackground, sectionCanvas, needle);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 7
Source File: IndicatorSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(gauge.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    sectionLayer = new Pane();
    sectionLayer.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(gauge.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);
    //bar.setMouseTransparent(sectionsAlwaysVisible ? true : false);
    bar.setVisible(!sectionsAlwaysVisible);

    needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep);

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleCubicCurveTo5 = new CubicCurveTo();
    needleCubicCurveTo6 = new CubicCurveTo();
    needleCubicCurveTo7 = new CubicCurveTo();
    needleClosePath8    = new ClosePath();
    needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleCubicCurveTo6, needleCubicCurveTo7, needleClosePath8);
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setPickOnBounds(false);
    needle.setStrokeType(StrokeType.INSIDE);
    needle.setStrokeWidth(1);
    needle.setStroke(gauge.getBackgroundPaint());

    needleTooltip = new Tooltip(String.format(locale, formatString, gauge.getValue()));
    needleTooltip.setTextAlignment(TextAlignment.CENTER);
    Tooltip.install(needle, needleTooltip);

    minValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue()));
    minValueText.setFill(gauge.getTitleColor());
    Helper.enableNode(minValueText, gauge.getTickLabelsVisible());

    maxValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
    maxValueText.setFill(gauge.getTitleColor());
    Helper.enableNode(maxValueText, gauge.getTickLabelsVisible());

    titleText = new Text(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    if (!sections.isEmpty() && sectionsVisible && !sectionsAlwaysVisible) {
        barTooltip = new Tooltip();
        barTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(bar, barTooltip);
    }

    pane = new Pane(barBackground, sectionLayer, bar, needle, minValueText, maxValueText, titleText);
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}