Search in sources :

Example 36 with Background

use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.

the class PromptLinesWrapper method updateUnfocusColor.

public void updateUnfocusColor() {
    Paint paint = control.getUnFocusColor();
    line.setBackground(paint == null ? Background.EMPTY : new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Paint(javafx.scene.paint.Paint)

Example 37 with Background

use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method playIndeterminateAnimation.

private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) {
    if (indeterminate == null) {
        indeterminate = false;
    }
    indeterminateTransition.setRate(indeterminate ? 1 : -1);
    if (playAnimation) {
        indeterminateTransition.play();
    } else {
        if (indeterminate) {
            CornerRadii radii = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getRadii();
            Insets insets = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getInsets();
            indeterminateMark.setOpacity(1);
            indeterminateMark.setScaleY(1);
            indeterminateMark.setScaleX(1);
            indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
            indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration());
        } else {
            indeterminateMark.setOpacity(0);
            indeterminateMark.setScaleY(0);
            indeterminateMark.setScaleX(0);
            indeterminateTransition.playFrom(Duration.ZERO);
        }
    }
    if (getSkinnable().isSelected()) {
        playSelectAnimation(!indeterminate, playAnimation);
    }
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 38 with Background

use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method playSelectAnimation.

private void playSelectAnimation(Boolean selection, boolean playAnimation) {
    if (selection == null) {
        selection = false;
    }
    transition.setRate(selection ? 1 : -1);
    select.setRate(selection ? 1 : -1);
    if (playAnimation) {
        transition.play();
        select.play();
    } else {
        CornerRadii radii = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getRadii();
        Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets();
        if (selection) {
            mark.setScaleY(1);
            mark.setScaleX(1);
            mark.setOpacity(1);
            box.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
            select.playFrom(select.getCycleDuration());
            transition.playFrom(transition.getCycleDuration());
        } else {
            mark.setScaleY(0);
            mark.setScaleX(0);
            mark.setOpacity(0);
            box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets)));
            select.playFrom(Duration.ZERO);
            transition.playFrom(Duration.ZERO);
        }
    }
    box.setBorder(new Border(new BorderStroke(selection ? getSkinnable().getCheckedColor() : getSkinnable().getUnCheckedColor(), BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(2))));
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Example 39 with Background

use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.

the class JFXColorPickerSkin method initColor.

private void initColor() {
    final ColorPicker colorPicker = (ColorPicker) getSkinnable();
    Color color = colorPicker.getValue();
    Color circleColor = color == null ? Color.WHITE : color;
    // update picker box color
    colorBox.setBackground(new Background(new BackgroundFill(circleColor, new CornerRadii(3), Insets.EMPTY)));
    // update label color
    displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf("rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
    if (colorLabelVisible.get()) {
        displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
    } else {
        displayNode.setText("");
    }
}
Also used : Background(javafx.scene.layout.Background) JFXColorPicker(com.jfoenix.controls.JFXColorPicker) ColorPicker(javafx.scene.control.ColorPicker) Color(javafx.scene.paint.Color) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 40 with Background

use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.

the class JFXDialog method initialize.

private void initialize() {
    this.setVisible(false);
    this.getStyleClass().add(DEFAULT_STYLE_CLASS);
    this.transitionType.addListener((o, oldVal, newVal) -> {
        animation = getShowAnimation(transitionType.get());
    });
    contentHolder = new StackPane();
    contentHolder.setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(2), null)));
    JFXDepthManager.setDepth(contentHolder, 4);
    contentHolder.setPickOnBounds(false);
    // ensure stackpane is never resized beyond it's preferred size
    contentHolder.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    this.getChildren().add(contentHolder);
    this.getStyleClass().add("jfx-dialog-overlay-pane");
    StackPane.setAlignment(contentHolder, Pos.CENTER);
    this.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.1), null, null)));
    // close the dialog if clicked on the overlay pane
    if (overlayClose.get()) {
        this.addEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler);
    }
    // prevent propagating the events to overlay pane
    contentHolder.addEventHandler(MouseEvent.ANY, e -> e.consume());
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii) StackPane(javafx.scene.layout.StackPane)

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