Search in sources :

Example 71 with Background

use of javafx.scene.layout.Background in project TeachingInSimulation by ScOrPiOzzy.

the class SVGGlyph method init.

// public SVGGlyph(String svgPathContent) {
// this(-1, "UNNAMED", svgPathContent, Color.BLACK);
// }
// public SVGGlyph(String svgPathContent, Paint fill) {
// this(-1, "UNNAMED", svgPathContent, fill);
// }
// /**
// * Constructs SVGGlyph node for a specified svg content and color <b>Note:</b> name and glyphId is not needed when creating a single SVG image, they have been used in {@link SVGHelper} to load icomoon svg font.
// * @param glyphId integer represents the glyph id
// * @param name glyph name
// * @param svgPathContent svg content
// * @param fill svg color
// */
// public SVGGlyph(int glyphId, String name, String svgPathContent, Paint fill) {
// this.glyphId = glyphId;
// this.name.set(name);
// init(svgPathContent, fill);
// }
private void init(String svgPathContent, Paint fill) {
    getStyleClass().add(DEFAULT_STYLE_CLASS);
    this.fill.addListener((observable) -> setBackground(new Background(new BackgroundFill(getFill() == null ? Color.BLACK : getFill(), null, null))));
    shapeProperty().addListener(observable -> {
        Shape shape = getShape();
        if (getShape() != null) {
            widthHeightRatio = shape.prefWidth(-1) / shape.prefHeight(-1);
            if (getSize() != Region.USE_COMPUTED_SIZE) {
                setSizeRatio(getSize());
            }
        }
    });
    SVGPath shape = new SVGPath();
    shape.setContent(svgPathContent);
    setShape(shape);
    setFill(fill);
    setPrefSize(DEFAULT_PREF_SIZE, DEFAULT_PREF_SIZE);
    getTransforms().add(new Scale(1, -1));
    Translate height = new Translate();
    height.yProperty().bind(Bindings.createDoubleBinding(() -> -this.getHeight(), this.heightProperty()));
    getTransforms().add(height);
}
Also used : Shape(javafx.scene.shape.Shape) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Scale(javafx.scene.transform.Scale) SVGPath(javafx.scene.shape.SVGPath) Translate(javafx.scene.transform.Translate)

Example 72 with Background

use of javafx.scene.layout.Background in project Smartcity-Smarthouse by TechnionYP5777.

the class DashboardController method initialize.

/*
     * (non-Javadoc)
     * 
     * @see il.ac.technion.cs.smarthouse.gui.controllers.SystemGuiController#
     * initialize(il.ac.technion.cs.smarthouse.system.SystemCore,
     * il.ac.technion.cs.smarthouse.gui_controller.GuiController,
     * il.ac.technion.cs.smarthouse.system.SystemMode, java.net.URL,
     * java.util.ResourceBundle)
     */
@Override
protected <T extends GuiController<SystemCore>> void initialize(final SystemCore model1, final T parent1, final SystemMode extraData1, final URL location, final ResourceBundle b) {
    filesystem = model1.getFileSystem();
    core = model1.getSystemDashboardCore();
    core.setWidgetPresenter(this::addWidget);
    core.setWidgetRemover(this::removeWidget);
    final Label plus = new Label("+");
    plus.setFont(Font.font("Arial Black", FontWeight.EXTRA_BOLD, 70));
    plus.setTextFill(Color.ANTIQUEWHITE);
    addWidgetTile = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.CUSTOM).graphic(plus).build();
    Tooltip addTooltip = new Tooltip("Click to add a widget");
    addTooltip.setStyle("-fx-font: System 12");
    addWidgetTile.setTooltip(addTooltip);
    addWidgetTile.setOnMouseClicked(e -> openConfigWindow());
    pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
    pane.setPrefSize(3000, 3000);
    pane.setPadding(new Insets(5));
    pane.getChildren().add(addWidgetTile);
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) Tooltip(javafx.scene.control.Tooltip) BackgroundFill(javafx.scene.layout.BackgroundFill) Label(javafx.scene.control.Label)

Example 73 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class Demo method start.

@Override
public void start(Stage stage) {
    FlowGridPane pane = new FlowGridPane(8, 5, percentageTile, clockTile, gaugeTile, sparkLineTile, areaChartTile, lineChartTile, timerControlTile, numberTile, textTile, highLowTile, plusMinusTile, sliderTile, switchTile, timeTile, barChartTile, customTile, leaderBoardTile, worldTile, mapTile, radialChartTile, donutChartTile, circularProgressTile, stockTile, gaugeSparkLineTile, radarChartTile1, radarChartTile2, smoothAreaChartTile, countryTile, ephemerisTile, characterTile, flipTile, switchSliderTile, dateTile, calendarTile, sunburstTile, matrixTile, // , weatherTile);
    radialPercentageTile);
    pane.setHgap(5);
    pane.setVgap(5);
    pane.setAlignment(Pos.CENTER);
    pane.setCenterShape(true);
    pane.setPadding(new Insets(5));
    // pane.setPrefSize(800, 600);
    pane.setBackground(new Background(new BackgroundFill(Color.web("#101214"), CornerRadii.EMPTY, Insets.EMPTY)));
    PerspectiveCamera camera = new PerspectiveCamera();
    camera.setFieldOfView(10);
    Scene scene = new Scene(pane);
    scene.setCamera(camera);
    stage.setTitle("TilesFX");
    stage.setScene(scene);
    stage.show();
    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
    timer.start();
    mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
    mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
    radialPercentageTile.showNotifier(true);
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) PerspectiveCamera(javafx.scene.PerspectiveCamera) Scene(javafx.scene.Scene) FlowGridPane(eu.hansolo.tilesfx.tools.FlowGridPane) Location(eu.hansolo.tilesfx.tools.Location)

Example 74 with Background

use of javafx.scene.layout.Background in project tilesfx by HanSolo.

the class TileSkin method redraw.

protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, tile.getRoundedCorners() ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, new BorderWidths(clamp(0, Double.MAX_VALUE, tile.getBorderWidth() / PREFERRED_WIDTH * size)))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), tile.getRoundedCorners() ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, Insets.EMPTY)));
    notifyRegion.setRoundedCorner(tile.getRoundedCorners());
    notifyRegion.setBackgroundColor(tile.getNotificationBackgroundColor());
    notifyRegion.setForegroundColor(tile.getNotificationForegroundColor());
    locale = tile.getLocale();
    formatString = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString();
    sectionsVisible = tile.getSectionsVisible();
    textSize = tile.getTextSize();
}
Also used : 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 75 with Background

use of javafx.scene.layout.Background 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);
    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);
    pane = new Pane(notifyRegion);
    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 : NotifyRegion(eu.hansolo.tilesfx.tools.NotifyRegion) 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) Pane(javafx.scene.layout.Pane) Border(javafx.scene.layout.Border) DropShadow(javafx.scene.effect.DropShadow)

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