Search in sources :

Example 11 with BackgroundFill

use of javafx.scene.layout.BackgroundFill 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 BackgroundFill

use of javafx.scene.layout.BackgroundFill 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 BackgroundFill

use of javafx.scene.layout.BackgroundFill 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 BackgroundFill

use of javafx.scene.layout.BackgroundFill 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)

Example 15 with BackgroundFill

use of javafx.scene.layout.BackgroundFill in project Gargoyle by callakrsos.

the class ColorAnalysisExam method start.

/*
	 * (non-Javadoc)
	 * 
	 * @see javafx.application.Application#start(javafx.stage.Stage)
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    BorderPane root = new BorderPane();
    ColorPicker value = new ColorPicker();
    root.setTop(value);
    List<Label> arrayList = new ArrayList<>();
    for (int i = 0; i < 7; i++) {
        Label region = new Label();
        region.setPrefWidth(100);
        region.setPrefHeight(100);
        String text = "";
        switch(i) {
            case 0:
                text = "Default";
                break;
            case 1:
                text = "Brigher";
                break;
            case 2:
                text = "darker";
                break;
            case 3:
                text = "desaturate";
                break;
            case 4:
                text = "grayscale";
                break;
            case 5:
                text = "invert";
                break;
            case 6:
                text = "saturate";
                break;
        }
        region.setText(text);
        arrayList.add(region);
    }
    Region region2 = new Region();
    region2.setPrefWidth(100);
    region2.setPrefHeight(100);
    value.valueProperty().addListener((oba, o, n) -> {
        arrayList.get(0).setBackground(new Background(new BackgroundFill(n, CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(1).setBackground(new Background(new BackgroundFill(n.brighter(), CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(2).setBackground(new Background(new BackgroundFill(n.darker(), CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(3).setBackground(new Background(new BackgroundFill(n.desaturate(), CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(4).setBackground(new Background(new BackgroundFill(n.grayscale(), CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(5).setBackground(new Background(new BackgroundFill(n.invert(), CornerRadii.EMPTY, new Insets(0))));
        arrayList.get(6).setBackground(new Background(new BackgroundFill(n.saturate(), CornerRadii.EMPTY, new Insets(0))));
    });
    HBox value2 = new HBox();
    value2.getChildren().addAll(arrayList);
    root.setCenter(value2);
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) HBox(jfxtras.scene.layout.HBox) Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) ColorPicker(javafx.scene.control.ColorPicker) BackgroundFill(javafx.scene.layout.BackgroundFill) ArrayList(java.util.ArrayList) Label(javafx.scene.control.Label) Scene(javafx.scene.Scene) Region(javafx.scene.layout.Region)

Aggregations

Background (javafx.scene.layout.Background)16 BackgroundFill (javafx.scene.layout.BackgroundFill)16 CornerRadii (javafx.scene.layout.CornerRadii)7 Insets (javafx.geometry.Insets)6 Color (javafx.scene.paint.Color)4 ArrayList (java.util.ArrayList)3 StackPane (javafx.scene.layout.StackPane)3 Tile (eu.hansolo.tilesfx.Tile)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Platform (javafx.application.Platform)2 FXCollections (javafx.collections.FXCollections)2 FXML (javafx.fxml.FXML)2 Node (javafx.scene.Node)2 Scene (javafx.scene.Scene)2 Label (javafx.scene.control.Label)2 FlowPane (javafx.scene.layout.FlowPane)2 VBox (javafx.scene.layout.VBox)2 XYLocation (aima.core.util.datastructure.XYLocation)1