Search in sources :

Example 1 with LowerRightRegion

use of eu.hansolo.tilesfx.tools.LowerRightRegion in project tilesfx by HanSolo.

the class TileSkin method initGraphics.

// ******************** Initialization ************************************
protected void initGraphics() {
    // Set initial size
    if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
        if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
            tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
        } else {
            tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }
    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);
    backgroundImageView = new ImageView();
    backgroundImageView.setPreserveRatio(true);
    backgroundImageView.setMouseTransparent(true);
    if (null == tile.getBackgroundImage()) {
        enableNode(backgroundImageView, false);
    } else {
        backgroundImageView.setImage(tile.getBackgroundImage());
        enableNode(backgroundImageView, true);
    }
    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);
    infoRegion = new InfoRegion();
    infoRegion.setPickOnBounds(false);
    enableNode(infoRegion, false);
    lowerRightRegion = new LowerRightRegion();
    enableNode(lowerRightRegion, false);
    pane = new Pane(backgroundImageView, notifyRegion, infoRegion, lowerRightRegion);
    pane.getStyleClass().add("tile");
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));
    getChildren().setAll(pane);
}
Also used : InfoRegion(eu.hansolo.tilesfx.tools.InfoRegion) NotifyRegion(eu.hansolo.tilesfx.tools.NotifyRegion) Background(javafx.scene.layout.Background) LowerRightRegion(eu.hansolo.tilesfx.tools.LowerRightRegion) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) ImageView(javafx.scene.image.ImageView) CornerRadii(javafx.scene.layout.CornerRadii) Pane(javafx.scene.layout.Pane) Border(javafx.scene.layout.Border) DropShadow(javafx.scene.effect.DropShadow)

Aggregations

InfoRegion (eu.hansolo.tilesfx.tools.InfoRegion)1 LowerRightRegion (eu.hansolo.tilesfx.tools.LowerRightRegion)1 NotifyRegion (eu.hansolo.tilesfx.tools.NotifyRegion)1 DropShadow (javafx.scene.effect.DropShadow)1 ImageView (javafx.scene.image.ImageView)1 Background (javafx.scene.layout.Background)1 BackgroundFill (javafx.scene.layout.BackgroundFill)1 Border (javafx.scene.layout.Border)1 BorderStroke (javafx.scene.layout.BorderStroke)1 BorderWidths (javafx.scene.layout.BorderWidths)1 CornerRadii (javafx.scene.layout.CornerRadii)1 Pane (javafx.scene.layout.Pane)1