Search in sources :

Example 46 with Region

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

the class JFXTextAreaSkin method layoutChildren.

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);
    final double height = getSkinnable().getHeight();
    linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
    linesWrapper.layoutPrompt(x, y, w, h);
    errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
    linesWrapper.updateLabelFloatLayout();
    if (invalid) {
        invalid = false;
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        errorContainer.invalid(w);
        // focus
        linesWrapper.invalid();
    }
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region)

Example 47 with Region

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

the class JFXRippler method getMask.

// methods that can be changed by extending the rippler class
/**
 * generate the clipping mask
 *
 * @return the mask node
 */
protected Node getMask() {
    double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0;
    Bounds bounds = control.getBoundsInParent();
    double width = control.getLayoutBounds().getWidth();
    double height = control.getLayoutBounds().getHeight();
    double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX());
    double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY());
    double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX());
    double diffMaxY = Math.abs(control.getBoundsInLocal().getMaxY() - control.getLayoutBounds().getMaxY());
    Node mask;
    switch(getMaskType()) {
        case RECT:
            mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth, // -0.1 to prevent resizing the anchor pane
            height - 2 * borderWidth);
            break;
        case CIRCLE:
            double radius = Math.min((width / 2) - 2 * borderWidth, (height / 2) - 2 * borderWidth);
            mask = new Circle((bounds.getMinX() + diffMinX + bounds.getMaxX() - diffMaxX) / 2 - snappedLeftInset(), (bounds.getMinY() + diffMinY + bounds.getMaxY() - diffMaxY) / 2 - snappedTopInset(), radius, Color.BLUE);
            break;
        case FIT:
            mask = new Region();
            if (control instanceof Shape) {
                ((Region) mask).setShape((Shape) control);
            } else if (control instanceof Region) {
                ((Region) mask).setShape(((Region) control).getShape());
                JFXNodeUtils.updateBackground(((Region) control).getBackground(), (Region) mask);
            }
            mask.resize(width, height);
            mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
            break;
        default:
            mask = new Rectangle(bounds.getMinX() + diffMinX - snappedLeftInset(), bounds.getMinY() + diffMinY - snappedTopInset(), width - 2 * borderWidth, // -0.1 to prevent resizing the anchor pane
            height - 2 * borderWidth);
            break;
    }
    return mask;
}
Also used : Circle(javafx.scene.shape.Circle) Shape(javafx.scene.shape.Shape) Bounds(javafx.geometry.Bounds) Node(javafx.scene.Node) Rectangle(javafx.scene.shape.Rectangle) Region(javafx.scene.layout.Region)

Example 48 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class TabIndicatorSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final Region circle = new Region();
    circle.getStyleClass().add("indicator-circle");
    final Text text = new Text();
    text.getStyleClass().add("indicator-information");
    text.textProperty().bind(getControl().textProperty());
    final StackPane container = new StackPane(circle, text);
    container.getStyleClass().add("indicator-container");
    final StackPane tabIndicator = new StackPane(container);
    tabIndicator.getStyleClass().add("tab-indicator");
    getChildren().add(tabIndicator);
}
Also used : Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) StackPane(javafx.scene.layout.StackPane)

Example 49 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class EngineInformationPanelSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane informationContentPane = new GridPane();
    informationContentPane.getStyleClass().add("grid");
    engineUserData.addListener((Observable invalidation) -> updateUserData(informationContentPane));
    updateUserData(informationContentPane);
    final HBox buttonBox = createEngineButtons();
    final Region informationContentSpacer = new Region();
    informationContentSpacer.getStyleClass().add("engineSpacer");
    final Region buttonBoxSpacer = new Region();
    buttonBoxSpacer.getStyleClass().add("engineSpacer");
    final VBox container = new VBox(informationContentPane, informationContentSpacer, buttonBox, buttonBoxSpacer);
    getChildren().add(container);
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Observable(javafx.beans.Observable)

Example 50 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class CompactListElementSkin method createMiniature.

/**
 * Creates a miniature icon for the item
 * @return A miniature icon for the item
 */
private Region createMiniature() {
    final Region icon = new Region();
    icon.getStyleClass().add("compactListMiniatureImage");
    icon.styleProperty().bind(Bindings.createStringBinding(() -> String.format("-fx-background-image: url(\"%s\");", getControl().getMiniatureUri().toString()), getControl().miniatureUriProperty()));
    return icon;
}
Also used : Region(javafx.scene.layout.Region)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8