Search in sources :

Example 21 with BorderStroke

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

the class JFXDecorator method initializeContainers.

private void initializeContainers(Node node, boolean fullScreen, boolean max, boolean min) {
    buttonsContainer = new HBox();
    buttonsContainer.getStyleClass().add("jfx-decorator-buttons-container");
    buttonsContainer.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
    // BINDING
    buttonsContainer.setPadding(new Insets(4));
    buttonsContainer.setAlignment(Pos.CENTER_RIGHT);
    // customize decorator buttons
    List<JFXButton> btns = new ArrayList<>();
    if (fullScreen) {
        btns.add(btnFull);
    }
    if (min) {
        btns.add(btnMin);
    }
    if (max) {
        btns.add(btnMax);
        // maximize/restore the window on header double click
        buttonsContainer.addEventHandler(MouseEvent.MOUSE_CLICKED, (mouseEvent) -> {
            if (mouseEvent.getClickCount() == 2) {
                btnMax.fire();
            }
        });
    }
    btns.add(btnClose);
    text = new Text();
    text.getStyleClass().addAll("jfx-decorator-text", "title", "jfx-decorator-title");
    text.setFill(Color.WHITE);
    // binds the Text's text to title
    text.textProperty().bind(title);
    // binds title to the primaryStage's title
    title.bind(primaryStage.titleProperty());
    graphicContainer = new HBox();
    graphicContainer.setPickOnBounds(false);
    graphicContainer.setAlignment(Pos.CENTER_LEFT);
    graphicContainer.getChildren().setAll(text);
    HBox graphicTextContainer = new HBox(graphicContainer, text);
    graphicTextContainer.getStyleClass().add("jfx-decorator-title-container");
    graphicTextContainer.setAlignment(Pos.CENTER_LEFT);
    graphicTextContainer.setPickOnBounds(false);
    HBox.setHgrow(graphicTextContainer, Priority.ALWAYS);
    HBox.setMargin(graphicContainer, new Insets(0, 8, 0, 8));
    buttonsContainer.getChildren().setAll(graphicTextContainer);
    buttonsContainer.getChildren().addAll(btns);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_ENTERED, (enter) -> allowMove = true);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_EXITED, (enter) -> {
        if (!isDragging) {
            allowMove = false;
        }
    });
    buttonsContainer.setMinWidth(180);
    contentPlaceHolder.getStyleClass().add("jfx-decorator-content-container");
    contentPlaceHolder.setMinSize(0, 0);
    StackPane clippedContainer = new StackPane(node);
    contentPlaceHolder.getChildren().add(clippedContainer);
    ((Region) node).setMinSize(0, 0);
    VBox.setVgrow(contentPlaceHolder, Priority.ALWAYS);
    contentPlaceHolder.getStyleClass().add("resize-border");
    contentPlaceHolder.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0, 4, 4, 4))));
    // BINDING
    Rectangle clip = new Rectangle();
    clip.widthProperty().bind(clippedContainer.widthProperty());
    clip.heightProperty().bind(clippedContainer.heightProperty());
    clippedContainer.setClip(clip);
    this.getChildren().addAll(buttonsContainer, contentPlaceHolder);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) ArrayList(java.util.ArrayList) Rectangle(javafx.scene.shape.Rectangle) Text(javafx.scene.text.Text) BorderWidths(javafx.scene.layout.BorderWidths) Region(javafx.scene.layout.Region) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border) StackPane(javafx.scene.layout.StackPane)

Example 22 with BorderStroke

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

the class PromptLinesWrapper method updateDisabled.

public void updateDisabled() {
    final boolean disabled = control.isDisable();
    line.setBorder(!disabled ? Border.EMPTY : new Border(new BorderStroke(control.getUnFocusColor(), BorderStrokeStyle.DASHED, CornerRadii.EMPTY, new BorderWidths(1))));
    line.setBackground(new Background(new BackgroundFill(disabled ? Color.TRANSPARENT : control.getUnFocusColor(), CornerRadii.EMPTY, Insets.EMPTY)));
}
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 23 with BorderStroke

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

the class JFXCheckBoxSkin method updateColors.

private void updateColors() {
    final Paint color = getSkinnable().isSelected() ? getSkinnable().getCheckedColor() : getSkinnable().getUnCheckedColor();
    JFXNodeUtils.updateBackground(indeterminateMark.getBackground(), indeterminateMark, getSkinnable().getCheckedColor());
    JFXNodeUtils.updateBackground(box.getBackground(), box, getSkinnable().isSelected() ? getSkinnable().getCheckedColor() : Color.TRANSPARENT);
    rippler.setRipplerFill(color);
    final BorderStroke borderStroke = box.getBorder().getStrokes().get(0);
    box.setBorder(new Border(new BorderStroke(color, borderStroke.getTopStyle(), borderStroke.getRadii(), borderStroke.getWidths())));
}
Also used : BorderStroke(javafx.scene.layout.BorderStroke) Paint(javafx.scene.paint.Paint) Border(javafx.scene.layout.Border)

Aggregations

Border (javafx.scene.layout.Border)23 BorderStroke (javafx.scene.layout.BorderStroke)23 BorderWidths (javafx.scene.layout.BorderWidths)18 Background (javafx.scene.layout.Background)13 BackgroundFill (javafx.scene.layout.BackgroundFill)13 CornerRadii (javafx.scene.layout.CornerRadii)10 Insets (javafx.geometry.Insets)9 Text (javafx.scene.text.Text)5 ArrayList (java.util.ArrayList)4 Label (javafx.scene.control.Label)4 List (java.util.List)3 BorderStrokeStyle (javafx.scene.layout.BorderStrokeStyle)3 Color (javafx.scene.paint.Color)3 ZonedDateTime (java.time.ZonedDateTime)2 Optional (java.util.Optional)2 ObservableList (javafx.collections.ObservableList)2 MouseEvent (javafx.scene.input.MouseEvent)2 StackPane (javafx.scene.layout.StackPane)2 VBox (javafx.scene.layout.VBox)2 Rectangle (javafx.scene.shape.Rectangle)2