Java Code Examples for javafx.scene.text.Text#setVisible()
The following examples show how to use
javafx.scene.text.Text#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: ParallelCoordinatesChart.java From charts with Apache License 2.0 | 5 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } axisCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); axisCtx = axisCanvas.getGraphicsContext2D(); Color selectionRectColor = getSelectionRectColor(); rect = new Rectangle(); rect.setMouseTransparent(true); rect.setVisible(false); rect.setStroke(Helper.getColorWithOpacity(selectionRectColor, 0.5)); rect.setFill(Helper.getColorWithOpacity(selectionRectColor, 0.25)); connectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); connectionCanvas.setMouseTransparent(true); connectionCtx = connectionCanvas.getGraphicsContext2D(); connectionCtx.setTextAlign(TextAlignment.LEFT); connectionCtx.setTextBaseline(VPos.CENTER); dragText = new Text(""); dragText.setVisible(false); dragText.setTextOrigin(VPos.CENTER); dragText.setFill(Helper.getColorWithOpacity(getHeaderColor(), 0.5)); getChildren().setAll(axisCanvas, rect, connectionCanvas, dragText); }
Example 2
Source File: HangmanMain.java From FXTutorials with MIT License | 5 votes |
public Letter(char letter) { bg.setFill(letter == ' ' ? Color.DARKSEAGREEN : Color.WHITE); bg.setStroke(Color.BLUE); text = new Text(String.valueOf(letter).toUpperCase()); text.setFont(DEFAULT_FONT); text.setVisible(false); setAlignment(Pos.CENTER); getChildren().addAll(bg, text); }
Example 3
Source File: BatterySkin.java From Medusa with Apache License 2.0 | 5 votes |
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); } } batteryBackground = new Path(); batteryBackground.setFillRule(FillRule.EVEN_ODD); batteryBackground.setStroke(null); battery = new Path(); battery.setFillRule(FillRule.EVEN_ODD); battery.setStroke(null); valueText = new Text(String.format(locale, "%.0f%%", gauge.getCurrentValue())); valueText.setVisible(gauge.isValueVisible()); valueText.setManaged(gauge.isValueVisible()); // Add all nodes pane = new Pane(); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); pane.getChildren().setAll(batteryBackground, battery, valueText); getChildren().setAll(pane); }
Example 4
Source File: RadarNodeChart.java From tilesfx with Apache License 2.0 | 4 votes |
private void initGraphics() { stops = new ArrayList<>(16); for (Stop stop : getGradientStops()) { if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor())); stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor())); } chartPath = new Path(); overlayPath = new Path(); overlayPath.setFill(Color.TRANSPARENT); centerCircle = new Circle(); thresholdCircle = new Circle(); thresholdCircle.setFill(Color.TRANSPARENT); unitText = new Text(getUnit()); unitText.setTextAlignment(TextAlignment.CENTER); unitText.setTextOrigin(VPos.CENTER); unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH)); legendStep = (getMaxValue() - getMinValue()) / 5d; dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0); minValueText = new Text(String.format(Locale.US, formatString, getMinValue())); minValueText.setTextAlignment(TextAlignment.CENTER); minValueText.setTextOrigin(VPos.CENTER); minValueText.setVisible(isLegendVisible()); minValueText.setEffect(dropShadow); legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep)); legend1Text.setTextAlignment(TextAlignment.CENTER); legend1Text.setTextOrigin(VPos.CENTER); legend1Text.setVisible(isLegendVisible()); legend1Text.setEffect(dropShadow); legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2)); legend2Text.setTextAlignment(TextAlignment.CENTER); legend2Text.setTextOrigin(VPos.CENTER); legend2Text.setVisible(isLegendVisible()); legend2Text.setEffect(dropShadow); legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend3Text.setTextAlignment(TextAlignment.CENTER); legend3Text.setTextOrigin(VPos.CENTER); legend3Text.setVisible(isLegendVisible()); legend3Text.setEffect(dropShadow); legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend4Text.setTextAlignment(TextAlignment.CENTER); legend4Text.setTextOrigin(VPos.CENTER); legend4Text.setVisible(isLegendVisible()); legend4Text.setEffect(dropShadow); maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue())); maxValueText.setTextAlignment(TextAlignment.CENTER); maxValueText.setTextOrigin(VPos.CENTER); maxValueText.setVisible(isLegendVisible()); maxValueText.setEffect(dropShadow); textGroup = new Group(); // Add all nodes pane = new Pane(chartPath, overlayPath, centerCircle, thresholdCircle, textGroup, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText); getChildren().setAll(pane); }
Example 5
Source File: DBClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(null); hour.setFill(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(null); minute.setFill(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.setFill(clock.getSecondColor()); second.getTransforms().setAll(secondRotate); enableNode(second, clock.isSecondsVisible()); 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); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(null); knob.setFill(clock.getKnobColor()); knob.setEffect(dropShadow); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond, knob); 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: ClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 || Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) { if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) { getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight()); } else { getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(getSkinnable().getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(getSkinnable().getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(getSkinnable().getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(getSkinnable().isSecondsVisible()); second.setManaged(getSkinnable().isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); 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); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(getSkinnable().getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(getSkinnable().getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(getSkinnable().getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(getSkinnable().isTitleVisible()); title.setManaged(getSkinnable().isTitleVisible()); dateText = new Text(""); dateText.setVisible(getSkinnable().isDateVisible()); dateText.setManaged(getSkinnable().isDateVisible()); text = new Text(""); text.setVisible(getSkinnable().isTextVisible()); text.setManaged(getSkinnable().isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(getSkinnable().getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 7
Source File: FatClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.setFill(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.setFill(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); 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(hour, minute); shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, text, shadowGroup); 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 8
Source File: PearClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); 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); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); 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 9
Source File: SlimClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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 10
Source File: RadarChart.java From tilesfx with Apache License 2.0 | 4 votes |
private void initGraphics() { stops = new ArrayList<>(16); for (Stop stop : getGradientStops()) { if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor())); stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor())); } chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); chartCtx = chartCanvas.getGraphicsContext2D(); overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); overlayCtx = overlayCanvas.getGraphicsContext2D(); unitText = new Text(getUnit()); unitText.setTextAlignment(TextAlignment.CENTER); unitText.setTextOrigin(VPos.CENTER); unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH)); legendStep = (getMaxValue() - getMinValue()) / 5d; dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0); minValueText = new Text(String.format(Locale.US, formatString, getMinValue())); minValueText.setTextAlignment(TextAlignment.CENTER); minValueText.setTextOrigin(VPos.CENTER); minValueText.setVisible(isLegendVisible()); minValueText.setEffect(dropShadow); legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep)); legend1Text.setTextAlignment(TextAlignment.CENTER); legend1Text.setTextOrigin(VPos.CENTER); legend1Text.setVisible(isLegendVisible()); legend1Text.setEffect(dropShadow); legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2)); legend2Text.setTextAlignment(TextAlignment.CENTER); legend2Text.setTextOrigin(VPos.CENTER); legend2Text.setVisible(isLegendVisible()); legend2Text.setEffect(dropShadow); legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend3Text.setTextAlignment(TextAlignment.CENTER); legend3Text.setTextOrigin(VPos.CENTER); legend3Text.setVisible(isLegendVisible()); legend3Text.setEffect(dropShadow); legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend4Text.setTextAlignment(TextAlignment.CENTER); legend4Text.setTextOrigin(VPos.CENTER); legend4Text.setVisible(isLegendVisible()); legend4Text.setEffect(dropShadow); maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue())); maxValueText.setTextAlignment(TextAlignment.CENTER); maxValueText.setTextOrigin(VPos.CENTER); maxValueText.setVisible(isLegendVisible()); maxValueText.setEffect(dropShadow); // Add all nodes pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText); pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 11
Source File: LcdClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5)); mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1 = new InnerShadow(); mainInnerShadow1.setOffsetX(0.0); mainInnerShadow1.setOffsetY(1.0); mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65)); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(crystalClip); boolean crystalEnabled = clock.isLcdCrystalEnabled(); crystalOverlay.setManaged(crystalEnabled); crystalOverlay.setVisible(crystalEnabled); boolean secondsVisible = clock.isSecondsVisible(); backgroundTimeText = new Text(""); backgroundTimeText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundTimeText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText = new Text(""); backgroundSecondText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundSecondText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText.setManaged(secondsVisible); backgroundSecondText.setVisible(secondsVisible); timeText = new Text(""); timeText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText = new Text(""); secondText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText.setManaged(secondsVisible); secondText.setVisible(secondsVisible); title = new Text(clock.getTitle()); title.setFill(clock.getLcdDesign().lcdForegroundColor); boolean titleVisible = clock.isTitleVisible(); title.setManaged(titleVisible); title.setVisible(titleVisible); dateText = new Text(dateFormat.format(clock.getTime())); dateText.setFill(clock.getLcdDesign().lcdForegroundColor); boolean dateVisible = clock.isDateVisible(); dateText.setManaged(dateVisible); dateText.setVisible(dateVisible); dayOfWeekText = new Text(""); dayOfWeekText.setFill(clock.getLcdDesign().lcdForegroundColor); dayOfWeekText.setManaged(dateVisible); dayOfWeekText.setVisible(dateVisible); alarm = new Path(); alarm.setFillRule(FillRule.EVEN_ODD); alarm.setStroke(null); boolean alarmVisible = clock.getAlarms().size() > 0; alarm.setManaged(alarmVisible); alarm.setVisible(alarmVisible); shadowGroup = new Group(); shadowGroup.setEffect(clock.getShadowsEnabled() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(timeText, secondText, title, dateText, dayOfWeekText, alarm); pane = new Pane(); pane.setEffect(clock.getShadowsEnabled() ? mainInnerShadow1 : null); pane.getChildren().setAll(crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup); getChildren().setAll(pane); }
Example 12
Source File: IndustrialClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); centerDot = new Circle(); centerDot.setFill(Color.WHITE); 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); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupMinute, shadowGroupHour, shadowGroupSecond, centerDot); 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 13
Source File: PlainClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.0148448); knob.setStroke(null); 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); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); 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 14
Source File: MinimalClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@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 15
Source File: FeedbackRegulator.java From regulators with Apache License 2.0 | 4 votes |
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(135, 255, 190)), new Stop(0.125, Color.rgb(254, 190, 106)), new Stop(0.389, Color.rgb(252, 84, 68)), new Stop(0.611, Color.rgb(99, 195, 255)), new Stop(1.0, Color.rgb(125, 255, 190)) }; barGradient = new ConicalGradient(stops); 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))); overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); overlayBarArc.setType(ArcType.OPEN); overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND); overlayBarArc.setFill(null); overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3)); overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get()); 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(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, currentValue.get())); text.setFill(textColor.get()); text.setTextOrigin(VPos.CENTER); targetText = new Text(String.format(Locale.US, formatString, targetValue.get())); targetText.setFill(textColor.get().darker()); targetText.setTextOrigin(VPos.CENTER); targetText.setVisible((int) targetValue.get() != (int) currentValue.get()); 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); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane); 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); }
Example 16
Source File: Callout.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void build() { // Create head Circle head = new Circle(getHeadPoint().getX(), getHeadPoint().getY(), 5); head.setFill(Color.WHITE); // First leader line Line firstLeaderLine = new Line(headPoint.getX(), headPoint.getY(), headPoint.getX(), headPoint.getY()); firstLeaderLine.setStroke(Color.WHITE); firstLeaderLine.setStrokeWidth(3); // Second part of the leader line Line secondLeaderLine = new Line(getLeaderLineToPoint().getX(), getLeaderLineToPoint().getY(), getLeaderLineToPoint().getX(), getLeaderLineToPoint().getY()); secondLeaderLine.setStroke(Color.WHITE); secondLeaderLine.setStrokeWidth(3); // Main title Rectangle HBox mainTitle = new HBox(); mainTitle.setBackground( new Background( new BackgroundFill(Color.WHITE, new CornerRadii(2), new Insets(0))) ); // Main title text Text mainTitleText = new Text(getMainTitleText()); HBox.setMargin(mainTitleText, new Insets(8, 8, 8, 8)); mainTitleText.setFont(Font.font(20)); mainTitle.getChildren().add(mainTitleText); // Position sub tile rectangle under main title Rectangle subTitleRect = new Rectangle(2, 20); subTitleRect.setFill(Color.WHITE); // Create the sub title HBox subTitle = new HBox(); subTitle.setBackground( new Background( new BackgroundFill(Color.color(0, 0, 0, .20), new CornerRadii(0), new Insets(0))) ); Text subTitleText = new Text(getSubTitleText()); subTitleText.setVisible(true); subTitleText.setFill(Color.WHITE); subTitleText.setFont(Font.font(14)); subTitle.getChildren().add(subTitleText); // Build the animation code. buildAnimation(head, firstLeaderLine, secondLeaderLine, mainTitle, subTitleRect, subTitle); // Must add nodes after buildAnimation. // Positioning calculations are done // outside of this Group. getChildren().addAll(head, firstLeaderLine, secondLeaderLine, mainTitle, subTitleRect, subTitle); getChildren().forEach(node -> node.setVisible(false)); }
Example 17
Source File: RadarChart.java From OEE-Designer with MIT License | 4 votes |
private void initGraphics() { stops = new ArrayList<>(16); for (Stop stop : getGradientStops()) { if (Double.compare(stop.getOffset(), 0.0) == 0) stops.add(new Stop(0, stop.getColor())); stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor())); } chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); chartCtx = chartCanvas.getGraphicsContext2D(); overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); overlayCtx = overlayCanvas.getGraphicsContext2D(); unitText = new Text(getUnit()); unitText.setTextAlignment(TextAlignment.CENTER); unitText.setTextOrigin(VPos.CENTER); unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH)); legendStep = (getMaxValue() - getMinValue()) / 5d; dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0); minValueText = new Text(String.format(Locale.US, formatString, getMinValue())); minValueText.setTextAlignment(TextAlignment.CENTER); minValueText.setTextOrigin(VPos.CENTER); minValueText.setVisible(isLegendVisible()); minValueText.setEffect(dropShadow); legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep)); legend1Text.setTextAlignment(TextAlignment.CENTER); legend1Text.setTextOrigin(VPos.CENTER); legend1Text.setVisible(isLegendVisible()); legend1Text.setEffect(dropShadow); legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2)); legend2Text.setTextAlignment(TextAlignment.CENTER); legend2Text.setTextOrigin(VPos.CENTER); legend2Text.setVisible(isLegendVisible()); legend2Text.setEffect(dropShadow); legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend3Text.setTextAlignment(TextAlignment.CENTER); legend3Text.setTextOrigin(VPos.CENTER); legend3Text.setVisible(isLegendVisible()); legend3Text.setEffect(dropShadow); legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3)); legend4Text.setTextAlignment(TextAlignment.CENTER); legend4Text.setTextOrigin(VPos.CENTER); legend4Text.setVisible(isLegendVisible()); legend4Text.setEffect(dropShadow); maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue())); maxValueText.setTextAlignment(TextAlignment.CENTER); maxValueText.setTextOrigin(VPos.CENTER); maxValueText.setVisible(isLegendVisible()); maxValueText.setEffect(dropShadow); // Add all nodes pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText); pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }