Search in sources :

Example 76 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class SmoothedChart method setSeriesColor.

public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint FILL, final Paint LEGEND_SYMBOL_FILL) {
    Background symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(1024), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(1024), new Insets(2)));
    setSeriesColor(SERIES, STROKE, FILL, symbolBackground, LEGEND_SYMBOL_FILL);
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 77 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class SunburstChart method redraw.

public void redraw() {
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth / PREFERRED_WIDTH * size))));
    segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
    segmentPane.setManaged(isInteractive());
    segmentPane.setVisible(isInteractive());
    drawChart();
}
Also used : Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 78 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class PercentageTileSkin method initGraphics.

// ******************** Initialization ************************************
@Override
protected void initGraphics() {
    super.initGraphics();
    barColor = tile.getBarColor();
    barBackground = new Region();
    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor(), new CornerRadii(0.0, 0.0, 0.025, 0.025, true), Insets.EMPTY)));
    barClip = new Rectangle();
    bar = new Rectangle();
    bar.setFill(tile.getBarColor());
    bar.setStroke(null);
    bar.setClip(barClip);
    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());
    valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
    valueText.setFill(tile.getValueColor());
    Helper.enableNode(valueText, tile.isValueVisible());
    unitText = new Text(tile.getUnit());
    unitText.setFill(tile.getUnitColor());
    Helper.enableNode(unitText, !tile.getUnit().isEmpty());
    valueUnitFlow = new TextFlow(valueText, unitText);
    valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
    description = new Label(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    description.setWrapText(true);
    description.setTextFill(tile.getTextColor());
    Helper.enableNode(description, !tile.getDescription().isEmpty());
    percentageText = new Text();
    percentageText.setFill(tile.getBarColor());
    percentageUnitText = new Text("%");
    percentageUnitText.setFill(tile.getBarColor());
    maxValueRect = new Rectangle();
    maxValueRect.setFill(tile.getThresholdColor());
    maxValueText = new Text();
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText = new Text(tile.getUnit());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    getPane().getChildren().addAll(barBackground, bar, titleText, valueUnitFlow, description, percentageText, percentageUnitText, maxValueRect, maxValueText, maxValueUnitText);
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Rectangle(javafx.scene.shape.Rectangle) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) CornerRadii(javafx.scene.layout.CornerRadii)

Example 79 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class PercentageTileSkin method redraw.

@Override
protected void redraw() {
    super.redraw();
    titleText.setText(tile.getTitle());
    unitText.setText(tile.getUnit());
    description.setText(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100));
    maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
    maxValueUnitText.setText(tile.getUnit());
    resizeStaticText();
    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY)));
    barColor = tile.getBarColor();
    if (sectionsVisible && !sections.isEmpty()) {
        setBarColor(tile.getValue());
    } else {
        bar.setFill(barColor);
    }
    titleText.setFill(tile.getTitleColor());
    unitText.setFill(tile.getUnitColor());
    description.setTextFill(tile.getDescriptionColor());
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor());
    valueText.setFill(tile.getValueColor());
    unitText.setFill(tile.getUnitColor());
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 80 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class RadarChart method resize.

// ******************** Private Methods ***********************************
private void resize() {
    double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
    double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size = width < height ? width : height;
    if (size > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
        pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
        chartCanvas.setWidth(size);
        chartCanvas.setHeight(size);
        overlayCanvas.setWidth(size);
        overlayCanvas.setHeight(size);
        redraw();
    }
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Aggregations

Background (javafx.scene.layout.Background)86 BackgroundFill (javafx.scene.layout.BackgroundFill)82 Insets (javafx.geometry.Insets)30 CornerRadii (javafx.scene.layout.CornerRadii)24 Scene (javafx.scene.Scene)18 StackPane (javafx.scene.layout.StackPane)15 Color (javafx.scene.paint.Color)15 Label (javafx.scene.control.Label)14 Border (javafx.scene.layout.Border)14 BorderStroke (javafx.scene.layout.BorderStroke)14 BorderWidths (javafx.scene.layout.BorderWidths)12 Pane (javafx.scene.layout.Pane)12 Text (javafx.scene.text.Text)9 BorderPane (javafx.scene.layout.BorderPane)8 Region (javafx.scene.layout.Region)8 HBox (javafx.scene.layout.HBox)7 ArrayList (java.util.ArrayList)6 MouseEvent (javafx.scene.input.MouseEvent)6 VBox (javafx.scene.layout.VBox)6 Rectangle (javafx.scene.shape.Rectangle)5