Java Code Examples for javafx.scene.shape.Circle#setVisible()

The following examples show how to use javafx.scene.shape.Circle#setVisible() . 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: JFXTimePickerContent.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private StackPane createMinutesContent(LocalTime time) {
    // create minutes content
    StackPane minsPointer = new StackPane();
    Circle selectionCircle = new Circle(contentCircleRadius / 6);
    selectionCircle.fillProperty().bind(timePicker.defaultColorProperty());

    Circle minCircle = new Circle(selectionCircle.getRadius() / 8);
    minCircle.setFill(Color.rgb(255, 255, 255, 0.87));
    minCircle.setTranslateX(selectionCircle.getRadius() - minCircle.getRadius());
    minCircle.setVisible(time.getMinute() % 5 != 0);
    selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> {
        if (Integer.parseInt(newVal) % 5 == 0) {
            minCircle.setVisible(false);
        } else {
            minCircle.setVisible(true);
        }
    });


    double shift = 9;
    Line line = new Line(shift, 0, contentCircleRadius, 0);
    line.fillProperty().bind(timePicker.defaultColorProperty());
    line.strokeProperty().bind(line.fillProperty());
    line.setStrokeWidth(1.5);
    minsPointer.getChildren().addAll(line, selectionCircle, minCircle);
    StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT);
    StackPane.setAlignment(minCircle, Pos.CENTER_LEFT);


    Group pointerGroup = new Group();
    pointerGroup.getChildren().add(minsPointer);
    pointerGroup.setTranslateX((-contentCircleRadius + shift) / 2);
    minsPointerRotate = new Rotate(0, contentCircleRadius - shift, selectionCircle.getRadius());
    pointerGroup.getTransforms().add(minsPointerRotate);

    Pane clockLabelsContainer = new Pane();
    // inner circle radius
    double radius = contentCircleRadius - shift - selectionCircle.getRadius();
    for (int i = 0; i < 12; i++) {
        StackPane labelContainer = new StackPane();
        int val = ((i + 3) * 5) % 60;
        Label label = new Label(String.valueOf(unitConverter.toString(val)));
        label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
        // init label color
        label.setTextFill(val == time.getMinute() ?
            Color.rgb(255, 255, 255, 0.87) : Color.rgb(0, 0, 0, 0.87));
        selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> {
            if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) {
                label.setTextFill(Color.rgb(255, 255, 255, 0.87));
            } else {
                label.setTextFill(Color.rgb(0, 0, 0, 0.87));
            }
        });

        labelContainer.getChildren().add(label);
        double labelSize = (selectionCircle.getRadius() / Math.sqrt(2)) * 2;
        labelContainer.setMinSize(labelSize, labelSize);

        double angle = 2 * i * Math.PI / 12;
        double xOffset = radius * Math.cos(angle);
        double yOffset = radius * Math.sin(angle);
        final double startx = contentCircleRadius + xOffset;
        final double starty = contentCircleRadius + yOffset;
        labelContainer.setLayoutX(startx - labelContainer.getMinWidth() / 2);
        labelContainer.setLayoutY(starty - labelContainer.getMinHeight() / 2);

        // add label to the parent node
        clockLabelsContainer.getChildren().add(labelContainer);
    }

    minsPointerRotate.setAngle(180 + (time.getMinute() + 45) % 60 * Math.toDegrees(2 * Math.PI / 60));

    return new StackPane(pointerGroup, clockLabelsContainer);
}
 
Example 2
Source File: LedSkin.java    From JFX8CustomControls with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    size   = getSkinnable().getPrefWidth() < getSkinnable().getPrefHeight() ? getSkinnable().getPrefWidth() : getSkinnable().getPrefHeight();

    frame = new Circle(0.5 * size, 0.5 * size, 0.5 * size);
    frame.setStroke(null);
    frame.setVisible(getSkinnable().isFrameVisible());

    main = new Circle(0.5 * size, 0.5 * size, 0.36 * size);
    main.setStroke(null);

    innerShadow = new InnerShadow();
    innerShadow.setRadius(0.090 * main.getLayoutBounds().getWidth());
    innerShadow.setColor(Color.BLACK);
    innerShadow.setBlurType(BlurType.GAUSSIAN);
    innerShadow.setInput(null);

    glow = new DropShadow();
    glow.setRadius(0.45 * main.getLayoutBounds().getWidth());
    glow.setColor((Color) getSkinnable().getLedColor());
    glow.setBlurType(BlurType.GAUSSIAN);
    glow.setInput(innerShadow);

    highlight = new Circle(0.5 * size, 0.5 * size, 0.29 * size);
    highlight.setStroke(null);

    getChildren().setAll(frame, main, highlight);
}
 
Example 3
Source File: StockTileSkin.java    From OEE-Designer with MIT License 4 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    averagingListener = o -> handleEvents("AVERAGING_PERIOD");

    timeFormatter = DateTimeFormatter.ofPattern("HH:mm", tile.getLocale());

    state = State.CONSTANT;

    if (tile.isAutoScale()) tile.calcAutoScale();

    low            = tile.getMaxValue();
    high           = tile.getMinValue();
    movingAverage  = tile.getMovingAverage();
    noOfDatapoints = tile.getAveragingPeriod();
    dataList       = new LinkedList<>();

    // To get smooth lines in the chart we need at least 4 values
    if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3.");

    graphBounds = new Rectangle(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.45);

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

    valueText = new Text(String.format(locale, formatString, tile.getValue()));
    valueText.setBoundsType(TextBoundsType.VISUAL);
    valueText.setFill(tile.getValueColor());
    Helper.enableNode(valueText, tile.isValueVisible());

    valueUnitFlow = new TextFlow(valueText);
    valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);

    highText = new Text();
    highText.setTextOrigin(VPos.BOTTOM);
    highText.setFill(tile.getValueColor());

    lowText = new Text();
    lowText.setTextOrigin(VPos.TOP);
    lowText.setFill(tile.getValueColor());

    text = new Text(tile.getText());
    text.setTextOrigin(VPos.TOP);
    text.setFill(tile.getTextColor());

    timeSpanText = new Text("");
    timeSpanText.setTextOrigin(VPos.TOP);
    timeSpanText.setFill(tile.getTextColor());
    Helper.enableNode(timeSpanText, !tile.isTextVisible());

    referenceLine = new Line();
    referenceLine.getStrokeDashArray().addAll(3d, 3d);
    referenceLine.setVisible(false);

    pathElements = new ArrayList<>(noOfDatapoints);
    pathElements.add(0, new MoveTo());
    for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }

    sparkLine = new Path();
    sparkLine.getElements().addAll(pathElements);
    sparkLine.setFill(null);
    sparkLine.setStroke(tile.getBarColor());
    sparkLine.setStrokeWidth(PREFERRED_WIDTH * 0.0075);
    sparkLine.setStrokeLineCap(StrokeLineCap.ROUND);
    sparkLine.setStrokeLineJoin(StrokeLineJoin.ROUND);

    dot = new Circle();
    dot.setFill(tile.getBarColor());
    dot.setVisible(false);

    triangle = new Path();
    triangle.setStroke(null);
    triangle.setFill(state.color);
    indicatorPane = new StackPane(triangle);

    changeText = new Label(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() - tile.getReferenceValue())));
    changeText.setTextFill(state.color);
    changeText.setAlignment(Pos.CENTER_RIGHT);

    changePercentageText = new Text(new StringBuilder().append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() / tile.getReferenceValue() * 100.0) - 100.0)).append("\u0025").toString());
    changePercentageText.setFill(state.color);

    changePercentageFlow = new TextFlow(indicatorPane, changePercentageText);
    changePercentageFlow.setTextAlignment(TextAlignment.RIGHT);

    getPane().getChildren().addAll(titleText, valueUnitFlow, sparkLine, dot, referenceLine, highText, lowText, timeSpanText, text, changeText, changePercentageFlow);
}
 
Example 4
Source File: StockTileSkin.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    averagingListener = o -> handleEvents("AVERAGING_PERIOD");

    timeFormatter = DateTimeFormatter.ofPattern("HH:mm", tile.getLocale());

    state = State.CONSTANT;

    if (tile.isAutoScale()) tile.calcAutoScale();

    low            = tile.getMaxValue();
    high           = tile.getMinValue();
    movingAverage  = tile.getMovingAverage();
    noOfDatapoints = tile.getAveragingPeriod();
    dataList       = new LinkedList<>();

    // To get smooth lines in the chart we need at least 4 values
    if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3.");

    graphBounds = new Rectangle(PREFERRED_WIDTH * 0.05, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.45);

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

    valueText = new Text(String.format(locale, formatString, tile.getValue()));
    valueText.setBoundsType(TextBoundsType.VISUAL);
    valueText.setFill(tile.getValueColor());
    Helper.enableNode(valueText, tile.isValueVisible());

    valueUnitFlow = new TextFlow(valueText);
    valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);

    highText = new Text();
    highText.setTextOrigin(VPos.BOTTOM);
    highText.setFill(tile.getValueColor());

    lowText = new Text();
    lowText.setTextOrigin(VPos.TOP);
    lowText.setFill(tile.getValueColor());

    text = new Text(tile.getText());
    text.setTextOrigin(VPos.TOP);
    text.setFill(tile.getTextColor());

    timeSpanText = new Text("");
    timeSpanText.setTextOrigin(VPos.TOP);
    timeSpanText.setFill(tile.getTextColor());
    Helper.enableNode(timeSpanText, !tile.isTextVisible());

    referenceLine = new Line();
    referenceLine.getStrokeDashArray().addAll(3d, 3d);
    referenceLine.setVisible(false);

    pathElements = new ArrayList<>(noOfDatapoints);
    pathElements.add(0, new MoveTo());
    for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }

    sparkLine = new Path();
    sparkLine.getElements().addAll(pathElements);
    sparkLine.setFill(null);
    sparkLine.setStroke(tile.getBarColor());
    sparkLine.setStrokeWidth(PREFERRED_WIDTH * 0.0075);
    sparkLine.setStrokeLineCap(StrokeLineCap.ROUND);
    sparkLine.setStrokeLineJoin(StrokeLineJoin.ROUND);

    dot = new Circle();
    dot.setFill(tile.getBarColor());
    dot.setVisible(false);

    triangle = new Path();
    triangle.setStroke(null);
    triangle.setFill(state.color);
    indicatorPane = new StackPane(triangle);

    changeText = new Label(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() - tile.getReferenceValue())));
    changeText.setTextFill(state.color);
    changeText.setAlignment(Pos.CENTER_RIGHT);

    changePercentageText = new Text(new StringBuilder().append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (tile.getCurrentValue() / tile.getReferenceValue() * 100.0) - 100.0)).append(Helper.PERCENTAGE).toString());
    changePercentageText.setFill(state.color);

    changePercentageFlow = new TextFlow(indicatorPane, changePercentageText);
    changePercentageFlow.setTextAlignment(TextAlignment.RIGHT);

    getPane().getChildren().addAll(titleText, valueUnitFlow, sparkLine, dot, referenceLine, highText, lowText, timeSpanText, text, changeText, changePercentageFlow);
}
 
Example 5
Source File: SlimClockSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
@Override protected void initGraphics() {
    // Set initial size
    if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
        if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
            clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
        } else {
            clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    ZonedDateTime time = clock.getTime();

    secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
    secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
    secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
    secondBackgroundCircle.setFill(null);
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondBackgroundCircle.setVisible(clock.isSecondsVisible());
    secondBackgroundCircle.setManaged(clock.isSecondsVisible());

    dateText = new Text(dateTextFormatter.format(time));
    dateText.setVisible(clock.isDayVisible());
    dateText.setManaged(clock.isDayVisible());

    dateNumbers = new Text(dateNumberFormatter.format(time));
    dateNumbers.setVisible(clock.isDateVisible());
    dateNumbers.setManaged(clock.isDateVisible());

    hour = new Text(HOUR_FORMATTER.format(time));
    hour.setFill(clock.getHourColor());

    minute = new Text(MINUTE_FORMATTER.format(time));
    minute.setFill(clock.getMinuteColor());

    secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
    secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondArc.setStrokeType(StrokeType.CENTERED);
    secondArc.setStrokeLineCap(StrokeLineCap.ROUND);
    secondArc.setFill(null);
    secondArc.setStroke(clock.getSecondColor());
    secondArc.setVisible(clock.isSecondsVisible());
    secondArc.setManaged(clock.isSecondsVisible());

    pane = new Pane(secondBackgroundCircle, dateText, dateNumbers, hour, minute, secondArc);
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

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

    ZonedDateTime time = clock.getTime();

    secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
    secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
    secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
    secondBackgroundCircle.setFill(null);
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondBackgroundCircle.setVisible(clock.isSecondsVisible());
    secondBackgroundCircle.setManaged(clock.isSecondsVisible());

    dateText = new Text(dateTextFormatter.format(time));
    dateText.setVisible(clock.isDateVisible());
    dateText.setManaged(clock.isDateVisible());

    hour = new Text(HOUR_FORMATTER.format(time));
    hour.setFill(clock.getHourColor());

    minute = new Text(MINUTE_FORMATTER.format(time));
    minute.setFill(clock.getMinuteColor());

    minuteCircle = new Circle(0.075 * PREFERRED_WIDTH);

    secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
    secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondArc.setStrokeType(StrokeType.CENTERED);
    secondArc.setStrokeLineCap(StrokeLineCap.BUTT);
    secondArc.setFill(null);
    secondArc.setStroke(clock.getSecondColor());
    secondArc.setVisible(clock.isSecondsVisible());
    secondArc.setManaged(clock.isSecondsVisible());

    pane = new Pane(secondBackgroundCircle, dateText, hour, secondArc, minuteCircle, minute);
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), new Insets(PREFERRED_WIDTH * 0.04))));

    getChildren().setAll(pane);
}
 
Example 7
Source File: BarSkin.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);
        }
    }

    Color barColor = gauge.getBarColor();
    gauge.setGradientBarStops(new Stop(0.0, barColor),
                                       new Stop(0.01, barColor),
                                       new Stop(0.75, barColor.deriveColor(-10, 1, 1, 1)),
                                       new Stop(1.0, barColor.deriveColor(-20, 1, 1, 1)));

    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.45), 0.01 * PREFERRED_WIDTH, 0, 0.01 * PREFERRED_WIDTH, 0);

    circle = new Circle();
    circle.setFill(null);

    arc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, 0);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    arc.setStrokeType(StrokeType.CENTERED);
    arc.setStrokeLineCap(StrokeLineCap.ROUND);
    arc.setFill(null);

    fakeDot = new Circle();
    fakeDot.setStroke(null);

    dot = new Circle();
    dot.setStroke(null);
    dot.setVisible(false);
    dot.setEffect(shadow);

    titleText = new Text(gauge.getTitle());
    titleText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.5));
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.setFont(Fonts.robotoRegular(PREFERRED_WIDTH * 0.27333));
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    unitText = new Text(gauge.getUnit());
    unitText.setFont(Fonts.robotoLight(PREFERRED_WIDTH * 0.08));
    unitText.setFill(gauge.getUnitColor());
    Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

    pane = new Pane(circle, arc, fakeDot, dot, titleText, valueText, unitText);

    getChildren().setAll(pane);
}
 
Example 8
Source File: ColorRegulator.java    From regulators with Apache License 2.0 4 votes vote down vote up
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);
}