Search in sources :

Example 11 with Background

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

the class JFXComboBox method defaultNodeConverter.

private static <T> NodeConverter<T> defaultNodeConverter() {
    return new NodeConverter<T>() {

        @Override
        public Node toNode(T object) {
            if (object == null)
                return null;
            StackPane selectedValueContainer = new StackPane();
            selectedValueContainer.getStyleClass().add("combo-box-selected-value-container");
            selectedValueContainer.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, null, null)));
            Label selectedValueLabel;
            if (object instanceof Label)
                selectedValueLabel = new Label(((Label) object).getText());
            else
                selectedValueLabel = new Label(object.toString());
            selectedValueLabel.setTextFill(Color.BLACK);
            selectedValueContainer.getChildren().add(selectedValueLabel);
            StackPane.setAlignment(selectedValueLabel, Pos.CENTER_LEFT);
            StackPane.setMargin(selectedValueLabel, new Insets(0, 0, 0, 5));
            return selectedValueContainer;
        }

        @SuppressWarnings("unchecked")
        @Override
        public T fromNode(Node node) {
            return (T) node;
        }

        @Override
        public String toString(T object) {
            if (object == null)
                return null;
            if (object instanceof Label)
                return ((Label) object).getText();
            return object.toString();
        }
    };
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) NodeConverter(com.jfoenix.converters.base.NodeConverter) BackgroundFill(javafx.scene.layout.BackgroundFill) Node(javafx.scene.Node) StackPane(javafx.scene.layout.StackPane)

Example 12 with Background

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

the class JFXFillTransition method interpolate.

/**
	 * {@inheritDoc}
	 */
@Override
protected void interpolate(double frac) {
    if (start == null)
        starting();
    Color newColor = start.interpolate(end, frac);
    if (Color.TRANSPARENT.equals(start))
        newColor = new Color(end.getRed(), end.getGreen(), end.getBlue(), newColor.getOpacity());
    region.get().setBackground(new Background(new BackgroundFill(newColor, radii, insets)));
}
Also used : Background(javafx.scene.layout.Background) Color(javafx.scene.paint.Color) BackgroundFill(javafx.scene.layout.BackgroundFill)

Example 13 with Background

use of javafx.scene.layout.Background in project Retrospector by NonlinearFruit.

the class Retrospector method init.

@Override
public void init() {
    ImageView splash = new ImageView(new Image(SPLASH_IMAGE, SPLASH_WIDTH, SPLASH_HEIGHT, true, true));
    loadProgress = new ProgressBar(0);
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label("Initializing . . .");
    progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE, new CornerRadii(5), new Insets(0))));
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    //        splashLayout.setEffect(new DropShadow());
    splashLayout.setBackground(Background.EMPTY);
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) CornerRadii(javafx.scene.layout.CornerRadii) ProgressBar(javafx.scene.control.ProgressBar) VBox(javafx.scene.layout.VBox)

Example 14 with Background

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

the class MainSystemGuiController method init.

@Override
public void init(final SystemCore model, final URL location, final ResourceBundle __) {
    try {
        // home tab:
        homeTab.setContent(homeTabHBox);
        homePageImageView.setImage(new Image(getClass().getResourceAsStream("/icons/smarthouse-icon-logo.png")));
        homePageImageView.setFitHeight(200);
        // homePageImageView.fitHeightProperty().bind(homeTabHBox.heightProperty().divide(2));
        final BackgroundImage myBI = new BackgroundImage(new Image(getClass().getResourceAsStream("/backgrounds/bg_4.png"), 0, 200, false, false), BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
        homeTabHBox.setBackground(new Background(myBI));
        // user tab:
        userTab.setContent(createChildPresenter("user information.fxml").getRootViewNode());
        // sensors tab:
        sensorsTab.setContent(createChildPresenter("house_mapping.fxml").getRootViewNode());
        // applications tab:
        appsPresenterInfo = createChildPresenter("application_view.fxml");
        appsTab.setContent(appsPresenterInfo.getRootViewNode());
    } catch (final Exception ¢) {
        ¢.printStackTrace();
    }
}
Also used : BackgroundImage(javafx.scene.layout.BackgroundImage) Background(javafx.scene.layout.Background) BackgroundImage(javafx.scene.layout.BackgroundImage) Image(javafx.scene.image.Image)

Example 15 with Background

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

the class Controller method initialize.

@Override
public void initialize(final URL location, final ResourceBundle __) {
    pane.setPrefSize(1200, 800);
    List<Tile> tiles = new ArrayList<>();
    for (int i = 0; i < ROWS_NUM * TILES_IN_ROW; ++i) {
        final Integer loc = i;
        final Tile t = TileBuilder.create().prefSize(TILE_SIZE, TILE_SIZE).skinType(SkinType.TEXT).description("Choose a widget:\nClick me!\t\t").descriptionAlignment(Pos.CENTER).textVisible(true).build();
        setTileEventHandlers(t, loc);
        tiles.add(t);
    }
    pane.getChildren().addAll(tiles);
    pane.setBackground(new Background(new BackgroundFill(Tile.BACKGROUND.darker(), null, null)));
// pane.setPadding(new Insets(5));
// pane.setPrefHeight((TILE_SIZE+8)*ROWS_NUM);
// pane.setPrefWidth((TILE_SIZE+8)*TILES_IN_ROW);
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) ArrayList(java.util.ArrayList) Tile(eu.hansolo.tilesfx.Tile)

Aggregations

Background (javafx.scene.layout.Background)17 BackgroundFill (javafx.scene.layout.BackgroundFill)15 Insets (javafx.geometry.Insets)6 CornerRadii (javafx.scene.layout.CornerRadii)6 Color (javafx.scene.paint.Color)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Optional (java.util.Optional)3 Platform (javafx.application.Platform)3 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)2 Tile (eu.hansolo.tilesfx.Tile)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 FXML (javafx.fxml.FXML)2 Node (javafx.scene.Node)2 Button (javafx.scene.control.Button)2 Label (javafx.scene.control.Label)2 Image (javafx.scene.image.Image)2 FlowPane (javafx.scene.layout.FlowPane)2 StackPane (javafx.scene.layout.StackPane)2