Java Code Examples for javafx.geometry.Insets#EMPTY

The following examples show how to use javafx.geometry.Insets#EMPTY . 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: CalendarTileSkin.java    From OEE-Designer with MIT License 5 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    clickHandler = e -> checkClick(e);

    labels = new ArrayList<>(56);
    for (int i = 0 ; i < 56 ; i++) {
        Label label = new Label();
        label.setManaged(false);
        label.setVisible(false);
        label.setAlignment(Pos.CENTER);
        label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
        labels.add(label);
    }

    weekBorder = new Border(new BorderStroke(Color.TRANSPARENT,
                                             Tile.GRAY,
                                             Color.TRANSPARENT,
                                             Color.TRANSPARENT,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.SOLID,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.NONE,
                                             CornerRadii.EMPTY, BorderWidths.DEFAULT,
                                             Insets.EMPTY));

    text = new Text(DAY_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text);
    getPane().getChildren().addAll(labels);
}
 
Example 2
Source File: TilesFXSeries.java    From OEE-Designer with MIT License 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint COLOR) {
    series = SERIES;
    stroke = COLOR;
    fill   = COLOR;
    if (null != COLOR) {
        symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = COLOR;
    }
}
 
Example 3
Source File: TilesFXSeries.java    From OEE-Designer with MIT License 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint STROKE, final Paint FILL) {
    series = SERIES;
    stroke = STROKE;
    fill   = FILL;
    if (null != stroke & null != fill) {
        symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = stroke;
    }
}
 
Example 4
Source File: GlowBackground.java    From AnimateFX with Apache License 2.0 5 votes vote down vote up
/**
     * Constructs the animation
     *
     * @param node       the node to animate
     * @param colorA     the color to start with
     * @param colorB     the other color
     * @param colorSteps how many interpolations between the two colors
     */
    public GlowBackground(Region node, Color colorA, Color colorB, int colorSteps) {
        super(node);
        this.originalBackground = getNode().backgroundProperty().get();
        if (originalBackground != null && !originalBackground.getFills().isEmpty()) {
            BackgroundFill lastFill = originalBackground.getFills().get(originalBackground.getFills().size() - 1);
            originalRadii = lastFill.getRadii();
            originalInsets = lastFill.getInsets();
        } else {
            originalRadii = CornerRadii.EMPTY;
            originalInsets = Insets.EMPTY;
        }

        int totalFrames = colorSteps * 2;
        double millisPerFrame = 1000 / totalFrames;
        for (int i = 0; i < totalFrames; i++) {
            Color color;
            double frac = i * 2.0 / totalFrames;
            Duration dur = Duration.millis(i * millisPerFrame);
            if (i <= colorSteps) {
                color = colorA.interpolate(colorB, frac);
            } else {
                color = colorB.interpolate(colorA, frac - 1);
            }
            getTimeline().getKeyFrames().add(
                    new KeyFrame(dur,
                            new KeyValue(getNode().backgroundProperty(),
//                                    new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)))));
                                    new Background(new BackgroundFill(color, originalRadii, originalInsets)))));
        }

    }
 
Example 5
Source File: CalendarTileSkin.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    clickHandler = e -> checkClick(e);

    labels = new ArrayList<>(56);
    for (int i = 0 ; i < 56 ; i++) {
        Label label = new Label();
        label.setManaged(false);
        label.setVisible(false);
        label.setAlignment(Pos.CENTER);
        label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
        labels.add(label);
    }

    weekBorder = new Border(new BorderStroke(Color.TRANSPARENT,
                                             Tile.GRAY,
                                             Color.TRANSPARENT,
                                             Color.TRANSPARENT,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.SOLID,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.NONE,
                                             CornerRadii.EMPTY, BorderWidths.DEFAULT,
                                             Insets.EMPTY));

    text = new Text(DAY_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text);
    getPane().getChildren().addAll(labels);
}
 
Example 6
Source File: TilesFXSeries.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint COLOR) {
    series = SERIES;
    stroke = COLOR;
    fill   = COLOR;
    if (null != COLOR) {
        symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = COLOR;
    }
}
 
Example 7
Source File: TilesFXSeries.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint STROKE, final Paint FILL) {
    series = SERIES;
    stroke = STROKE;
    fill   = FILL;
    if (null != stroke & null != fill) {
        symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = stroke;
    }
}
 
Example 8
Source File: JFXToggleNodeSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
public void updateSelectionBackground() {
    CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground()
        .getFills()
        .get(0)
        .getRadii();
    Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground()
        .getFills()
        .get(0)
        .getInsets();
    selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable())
        .getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets)));
}
 
Example 9
Source File: SmoothedChart.java    From OEE-Designer with MIT License 4 votes vote down vote up
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint COLOR) {
    Background symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
    setSeriesColor(SERIES, COLOR, COLOR, symbolBackground, COLOR);
}
 
Example 10
Source File: SmoothedChart.java    From OEE-Designer with MIT License 4 votes vote down vote up
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint 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, STROKE);
}
 
Example 11
Source File: SmoothedChart.java    From OEE-Designer with MIT License 4 votes vote down vote up
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);
}
 
Example 12
Source File: SmoothedChart.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint COLOR) {
    Background symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
    setSeriesColor(SERIES, COLOR, COLOR, symbolBackground, COLOR);
}
 
Example 13
Source File: SmoothedChart.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint 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, STROKE);
}
 
Example 14
Source File: SmoothedChart.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 15
Source File: ChargeSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
@Override protected void resize() {
    width  = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight();
    height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom();

    if (aspectRatio * width > height) {
        width = 1 / (aspectRatio / height);
    } else if (1 / (aspectRatio / height) > width) {
        height = aspectRatio * width;
    }

    if (width > 0 && height > 0) {
        pane.setMaxSize(width, height);
        pane.setPrefSize(width, height);
        pane.relocate((gauge.getWidth() - width) * 0.5, (gauge.getHeight() - height) * 0.5);
        pane.setSpacing(width * 0.01960784);

        double barWidth = 0;
        for (int i = 0 ; i < 12 ; i++) {
            bars[i].setPrefSize(0.3030303 * height, (0.3030303 * height + i * 0.06060606 * height));
            Bounds bounds = bars[i].getLayoutBounds();
            barWidth      = bounds.getWidth();
            if (barWidth == 0) return;

            BarColor barColor;
            if (i < 2) {
                barColor = BarColor.RED;
            } else if (i < 9) {
                barColor = BarColor.ORANGE;
            } else {
                barColor = BarColor.GREEN;
            }
            barBackgrounds[i] = new Background(new BackgroundFill[] {
                new BackgroundFill(Color.WHITE, new CornerRadii(1024), Insets.EMPTY),
                new BackgroundFill(new LinearGradient(0, bounds.getMinY(), 0, bounds.getMaxY(), false, CycleMethod.NO_CYCLE, new Stop(0.0, barColor.COLOR_FROM), new Stop(1.0, barColor.COLOR_TO)), new CornerRadii(1024), new Insets(0.15 * barWidth))
            });
            barBackgrounds[i + 12] = new Background(new BackgroundFill[] {
                new BackgroundFill(Color.WHITE, new CornerRadii(1024), Insets.EMPTY),
                new BackgroundFill(new LinearGradient(0, bounds.getMinY(), 0, bounds.getMaxY(), false, CycleMethod.NO_CYCLE, new Stop(0.0, BarColor.GRAY.COLOR_FROM), new Stop(1.0, BarColor.GRAY.COLOR_TO)), new CornerRadii(1024), new Insets(0.15 * barWidth))
            });
        }
        barBorder = new Border(new BorderStroke(Color.rgb(102, 102, 102), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(0.05 * barWidth)));
    }
    redraw();
}