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);
            }
        }

        shadow     = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 12, 0, 3, 3);
        textShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 4, 0, 2, 2);

        valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
        valueText.setFill(Color.WHITE);
        valueText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.20625));
        valueText.setTextOrigin(VPos.CENTER);
        valueText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.46875);
        valueText.setEffect(textShadow);
        Helper.enableNode(valueText, gauge.isValueVisible());

        unitText  = new Text(gauge.getUnit());
        unitText.setFill(Color.WHITE);
        unitText.setFont(Fonts.robotoBold(PREFERRED_WIDTH * 0.0875));
        unitText.setTextOrigin(VPos.CENTER);
        unitText.relocate(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.65625);
        unitText.setEffect(textShadow);
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

        backgroundRing = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                                 PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                                 0, 360);
        backgroundRing.setFill(null);
        backgroundRing.setStroke(Color.rgb(255, 255, 255, 0.9));
        backgroundRing.setStrokeLineCap(StrokeLineCap.BUTT);
        backgroundRing.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
        backgroundRing.setEffect(shadow);

        barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                                PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                                0, 360);
        barBackground.setFill(null);
        barBackground.setStroke(Color.rgb(255, 255, 255, 0.4));
        barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
        barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.1375);

        bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
                      PREFERRED_WIDTH * 0.43125, PREFERRED_HEIGHT * 0.43125,
                      90, -gauge.getAngleStep() * gauge.getValue());
        bar.setFill(null);
        bar.setStroke(Color.WHITE);
        bar.setStrokeWidth(PREFERRED_WIDTH * 0.1375);
        bar.setStrokeLineCap(StrokeLineCap.BUTT);

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

        getChildren().setAll(pane);
    }
private void initGraphics ( ) { 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 ) ; } } shadow = new DropShadow ( BlurType . TWO_PASS_BOX , Color . rgb ( 0 , 0 , 0 , 0.65 ) , 12 , 0 , 3 , 3 ) ; textShadow = new DropShadow ( BlurType . TWO_PASS_BOX , Color . rgb ( 0 , 0 , 0 , 0.65 ) , 4 , 0 , 2 , 2 ) ; valueText = new Text ( formatNumber ( gauge . getLocale ( ) , gauge . getFormatString ( ) , gauge . getDecimals ( ) , gauge . getCurrentValue ( ) ) ) ; valueText . setFill ( Color . WHITE ) ; valueText . setFont ( Fonts . robotoBold ( PREFERRED_WIDTH * 0.20625 ) ) ; valueText . setTextOrigin ( VPos . CENTER ) ; valueText . relocate ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.46875 ) ; valueText . setEffect ( textShadow ) ; Helper . enableNode ( valueText , gauge . isValueVisible ( ) ) ; unitText = new Text ( gauge . getUnit ( ) ) ; unitText . setFill ( Color . WHITE ) ; unitText . setFont ( Fonts . robotoBold ( PREFERRED_WIDTH * 0.0875 ) ) ; unitText . setTextOrigin ( VPos . CENTER ) ; unitText . relocate ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.65625 ) ; unitText . setEffect ( textShadow ) ; Helper . enableNode ( unitText , ! gauge . getUnit ( ) . isEmpty ( ) ) ; backgroundRing = new Arc ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.43125 , PREFERRED_HEIGHT * 0.43125 , 0 , 360 ) ; backgroundRing . setFill ( null ) ; backgroundRing . setStroke ( Color . rgb ( 255 , 255 , 255 , 0.9 ) ) ; backgroundRing . setStrokeLineCap ( StrokeLineCap . BUTT ) ; backgroundRing . setStrokeWidth ( PREFERRED_WIDTH * 0.1375 ) ; backgroundRing . setEffect ( shadow ) ; barBackground = new Arc ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.43125 , PREFERRED_HEIGHT * 0.43125 , 0 , 360 ) ; barBackground . setFill ( null ) ; barBackground . setStroke ( Color . rgb ( 255 , 255 , 255 , 0.4 ) ) ; barBackground . setStrokeLineCap ( StrokeLineCap . BUTT ) ; barBackground . setStrokeWidth ( PREFERRED_WIDTH * 0.1375 ) ; bar = new Arc ( PREFERRED_WIDTH * 0.5 , PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.43125 , PREFERRED_HEIGHT * 0.43125 , 90 , - gauge . getAngleStep ( ) * gauge . getValue ( ) ) ; bar . setFill ( null ) ; bar . setStroke ( Color . WHITE ) ; bar . setStrokeWidth ( PREFERRED_WIDTH * 0.1375 ) ; bar . setStrokeLineCap ( StrokeLineCap . BUTT ) ; pane = new Pane ( valueText , unitText , backgroundRing , barBackground , bar ) ; pane . setBackground ( new Background ( new BackgroundFill ( gauge . getBackgroundPaint ( ) , new CornerRadii ( 1024 ) , Insets . EMPTY ) ) ) ; pane . setBorder ( new Border ( new BorderStroke ( gauge . getBorderPaint ( ) , BorderStrokeStyle . SOLID , new CornerRadii ( 1024 ) , new BorderWidths ( gauge . getBorderWidth ( ) ) ) ) ) ; getChildren ( ) . setAll ( pane ) ; }
******************** Initialization ************************************