Search in sources :

Example 46 with Background

use of javafx.scene.layout.Background in project Board-Instrumentation-Framework by intel.

the class Demo method start.

@Override
public void start(Stage stage) {
    HBox lcd = new HBox();
    lcd.setPadding(new Insets(15, 15, 15, 15));
    lcd.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
    lcd.setSpacing(10);
    lcd.setAlignment(Pos.CENTER);
    lcd.setFillHeight(false);
    HBox.setMargin(seg3, new Insets(0, 20, 0, 0));
    lcd.getChildren().addAll(seg0, seg1, seg2, seg3, seg4, seg5);
    /*
        for (int i = 0 ; i < 256 ; i++) {
            System.out.println(i + "   :   " + Character.toString((char) i));
        }
        */
    StackPane pane = new StackPane();
    pane.getChildren().setAll(lcd);
    Scene scene = new Scene(pane, Color.BLACK);
    stage.setTitle("Sixteen Segment DemoGauge");
    stage.setScene(scene);
    stage.show();
    timer.start();
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 47 with Background

use of javafx.scene.layout.Background in project tokentool by RPTools.

the class TokenTool_Controller method initialize.

@FXML
void initialize() {
    // events
    assert fileOpenPDF_Menu != null : "fx:id=\"fileOpenPDF_Menu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileManageOverlaysMenu != null : "fx:id=\"fileManageOverlaysMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileSaveAsMenu != null : "fx:id=\"fileSaveAsMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileExitMenu != null : "fx:id=\"fileExitMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert editCaptureScreenMenu != null : "fx:id=\"editCaptureScreenMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert editCopyImageMenu != null : "fx:id=\"editCopyImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert editPasteImageMenu != null : "fx:id=\"editPasteImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert helpAboutMenu != null : "fx:id=\"helpAboutMenu\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert saveOptionsPane != null : "fx:id=\"saveOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayOptionsPane != null : "fx:id=\"overlayOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert backgroundOptionsPane != null : "fx:id=\"backgroundOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert zoomOptionsPane != null : "fx:id=\"zoomOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert compositeTokenPane != null : "fx:id=\"compositeTokenPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert tokenPreviewPane != null : "fx:id=\"tokenPreviewPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitScrollPane != null : "fx:id=\"portraitScrollPane\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert compositeGroup != null : "fx:id=\"compositeGroup\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert dndHighlights != null : "fx:id=\"dndHighlights\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayTreeView != null : "fx:id=\"overlayTreeview\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert backgroundImageView != null : "fx:id=\"backgroundImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitImageView != null : "fx:id=\"portraitImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert maskImageView != null : "fx:id=\"maskImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayImageView != null : "fx:id=\"overlayImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert tokenImageView != null : "fx:id=\"tokenImageView\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert useFileNumberingCheckbox != null : "fx:id=\"useFileNumberingCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert useTokenNameCheckbox != null : "fx:id=\"useTokenNameCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert savePortraitOnDragCheckbox != null : "fx:id=\"savePortraitOnDragCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert useBackgroundOnDragCheckbox != null : "fx:id=\"useBackgroundOnDragCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayUseAsBaseCheckbox != null : "fx:id=\"overlayUseAsBaseCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert clipPortraitCheckbox != null : "fx:id=\"clipPortraitCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileNameTextField != null : "fx:id=\"fileNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileNameSuffixLabel != null : "fx:id=\"fileNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert fileNameSuffixTextField != null : "fx:id=\"fileNameSuffixTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitNameTextField != null : "fx:id=\"portraitNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitNameSuffixLabel != null : "fx:id=\"portraitNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitNameSuffixTextField != null : "fx:id=\"portraitNameSuffixTextField\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayNameLabel != null : "fx:id=\"overlayNameLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayInfoLabel != null : "fx:id=\"overlayInfoLabel\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert backgroundColorPicker != null : "fx:id=\"backgroundColorPicker\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayAspectToggleButton != null : "fx:id=\"overlayAspectToggleButton\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitTransparencySlider != null : "fx:id=\"portraitTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitBlurSlider != null : "fx:id=\"portraitBlurSlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitGlowSlider != null : "fx:id=\"portraitGlowSlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayTransparencySlider != null : "fx:id=\"overlayTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayWidthSpinner != null : "fx:id=\"overlayWidthSpinner\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayHeightSpinner != null : "fx:id=\"overlayHeightSpinner\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayTreeProgressBar != null : "fx:id=\"overlayTreeProgressIndicator\" was not injected: check your FXML file 'ManageOverlays.fxml'.";
    assert layerMenuButton != null : "fx:id=\"layerMenuButton\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert backgroundMenuItem != null : "fx:id=\"backgroundMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert portraitMenuItem != null : "fx:id=\"portraitMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
    assert overlayMenuItem != null : "fx:id=\"overlayMenuItem\" was not injected: check your FXML file 'TokenTool.fxml'.";
    // We're getting the defaults set by the FXML before updating them with the saved preferences...
    AppConstants.DEFAULT_MASK_IMAGE = maskImageView.getImage();
    AppConstants.DEFAULT_OVERLAY_IMAGE = overlayImageView.getImage();
    AppConstants.DEFAULT_PORTRAIT_IMAGE = portraitImageView.getImage();
    AppConstants.DEFAULT_PORTRAIT_IMAGE_X = portraitImageView.getTranslateX();
    AppConstants.DEFAULT_PORTRAIT_IMAGE_Y = portraitImageView.getTranslateY();
    AppConstants.DEFAULT_PORTRAIT_IMAGE_SCALE = portraitImageView.getScaleY();
    AppConstants.DEFAULT_PORTRAIT_IMAGE_ROTATE = portraitImageView.getRotate();
    AppConstants.DEFAULT_SAVE_PORTRAIT_ON_DRAG = getSavePortraitOnDragCheckbox();
    AppConstants.DEFAULT_USE_BACKGROUND_ON_DRAG = getUseBackgroundOnDragCheckbox();
    AppConstants.DEFAULT_PORTRAIT_NAME_TEXT_FIELD = getPortraitNameTextField();
    AppConstants.DEFAULT_USE_TOKEN_NAME = getUseTokenNameCheckbox();
    AppConstants.DEFAULT_PORTRAIT_NAME_SUFFIX_TEXT_FIELD = getPortraitNameSuffixTextField();
    executorService = Executors.newCachedThreadPool(runable -> {
        loadOverlaysThread = Executors.defaultThreadFactory().newThread(runable);
        loadOverlaysThread.setDaemon(true);
        return loadOverlaysThread;
    });
    overlayTreeView.setShowRoot(false);
    overlayTreeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> updateCompositImageView((TreeItem<Path>) newValue));
    addPseudoClassToLeafs(overlayTreeView);
    // Bind color picker to compositeTokenPane background fill
    backgroundColorPicker.setValue(Color.TRANSPARENT);
    ObjectProperty<Background> background = compositeTokenPane.backgroundProperty();
    background.bind(Bindings.createObjectBinding(() -> {
        BackgroundFill fill = new BackgroundFill(backgroundColorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY);
        return new Background(fill);
    }, backgroundColorPicker.valueProperty()));
    // Bind transparency slider to portraitImageView opacity
    portraitTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            portraitImageView.setOpacity(new_val.doubleValue());
            updateTokenPreviewImageView();
        }
    });
    // Set filters and bindings for file name inputs
    UnaryOperator<Change> filter = change -> {
        String text = change.getText();
        if (text.matches(AppConstants.VALID_FILE_NAME_PATTERN)) {
            return change;
        } else {
            change.setText(FileSaveUtil.cleanFileName(text));
            ;
            return change;
        }
    // 
    // return null;
    };
    fileNameTextField.setTextFormatter(new TextFormatter<>(filter));
    portraitNameTextField.setTextFormatter(new TextFormatter<>(filter));
    portraitNameTextField.textProperty().bind(fileNameTextField.textProperty().concat(portraitNameSuffixTextField.textProperty()));
    // Bind portrait name to token name if useTokenNameCheckbox is checked
    portraitNameTextField.disableProperty().bind(useTokenNameCheckbox.selectedProperty());
    portraitNameSuffixLabel.disableProperty().bind(useTokenNameCheckbox.selectedProperty().not());
    portraitNameSuffixTextField.disableProperty().bind(useTokenNameCheckbox.selectedProperty().not());
    // Bind the use background on drag to save portrait on drag checkbox
    useBackgroundOnDragCheckbox.disableProperty().bind(savePortraitOnDragCheckbox.selectedProperty().not());
    useTokenNameCheckbox.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> {
        if (isNowSelected) {
            portraitNameTextField.textProperty().bind(fileNameTextField.textProperty().concat(portraitNameSuffixTextField.textProperty()));
        } else {
            portraitNameTextField.textProperty().unbind();
        }
    });
    /* Effects */
    GaussianBlur gaussianBlur = new GaussianBlur(0);
    Glow glow = new Glow(0);
    gaussianBlur.setInput(glow);
    // Bind blur slider to portraitImageView opacity
    portraitBlurSlider.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            gaussianBlur.setRadius(new_val.doubleValue());
            portraitImageView.setEffect(gaussianBlur);
            updateTokenPreviewImageView();
        }
    });
    // Bind glow slider to portraitImageView opacity
    portraitGlowSlider.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            glow.setLevel(new_val.doubleValue());
            portraitImageView.setEffect(gaussianBlur);
            updateTokenPreviewImageView();
        }
    });
    // Bind transparency slider to overlayImageView opacity
    overlayTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            overlayImageView.setOpacity(new_val.doubleValue());
            updateTokenPreviewImageView();
        }
    });
    // Bind width/height spinners to overlay width/height
    overlayWidthSpinner.getValueFactory().valueProperty().bindBidirectional(overlayHeightSpinner.getValueFactory().valueProperty());
    overlayWidthSpinner.valueProperty().addListener((observable, oldValue, newValue) -> overlayWidthSpinner_onTextChanged(oldValue, newValue));
    overlayWidthSpinner.getValueFactory().setConverter(new StringConverter<Integer>() {

        @Override
        public String toString(Integer object) {
            return object.toString();
        }

        @Override
        public Integer fromString(String string) {
            int value = 256;
            try {
                value = Integer.parseInt(string);
            } catch (NumberFormatException e) {
                log.debug("Invalid overlay size entered.", e);
            }
            return value;
        }
    });
    overlayHeightSpinner.valueProperty().addListener((observable, oldValue, newValue) -> overlayHeightSpinner_onTextChanged(oldValue, newValue));
    overlayHeightSpinner.getValueFactory().setConverter(new StringConverter<Integer>() {

        @Override
        public String toString(Integer object) {
            return object.toString();
        }

        @Override
        public Integer fromString(String string) {
            int value = 256;
            try {
                value = Integer.parseInt(string);
            } catch (NumberFormatException e) {
                log.info("NOPE");
            }
            return value;
        }
    });
    // Bind the background/portrait pane widths to keep things centered.
    // Otherwise StackPane sets width/height to largest value from the ImageView nodes within it
    imagesStackPane.minWidthProperty().bind(compositeTokenPane.widthProperty());
    imagesStackPane.minHeightProperty().bind(compositeTokenPane.heightProperty());
}
Also used : Arrays(java.util.Arrays) TypeToken(com.google.gson.reflect.TypeToken) PseudoClass(javafx.css.PseudoClass) UnaryOperator(java.util.function.UnaryOperator) StackPane(javafx.scene.layout.StackPane) TextFormatter(javafx.scene.control.TextFormatter) DragEvent(javafx.scene.input.DragEvent) RegionSelector(net.rptools.tokentool.client.RegionSelector) ScrollPane(javafx.scene.control.ScrollPane) Map(java.util.Map) GaussianBlur(javafx.scene.effect.GaussianBlur) Path(java.nio.file.Path) KeyEvent(javafx.scene.input.KeyEvent) Group(javafx.scene.Group) Executors(java.util.concurrent.Executors) Platform(javafx.application.Platform) Logger(org.apache.logging.log4j.Logger) Clipboard(javafx.scene.input.Clipboard) MenuButton(javafx.scene.control.MenuButton) BorderPane(javafx.scene.layout.BorderPane) TreeItem(javafx.scene.control.TreeItem) PdfViewer(net.rptools.tokentool.client.PdfViewer) FileSaveUtil(net.rptools.tokentool.util.FileSaveUtil) Bindings(javafx.beans.binding.Bindings) TreeSet(java.util.TreeSet) TransferMode(javafx.scene.input.TransferMode) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Dragboard(javafx.scene.input.Dragboard) FadeTransition(javafx.animation.FadeTransition) ProgressBar(javafx.scene.control.ProgressBar) Slider(javafx.scene.control.Slider) I18N(net.rptools.tokentool.util.I18N) Color(javafx.scene.paint.Color) Change(javafx.scene.control.TextFormatter.Change) TitledPane(javafx.scene.control.TitledPane) Files(java.nio.file.Files) CheckBox(javafx.scene.control.CheckBox) IOException(java.io.IOException) StringConverter(javafx.util.StringConverter) Background(javafx.scene.layout.Background) File(java.io.File) Cursor(javafx.scene.Cursor) FileChooser(javafx.stage.FileChooser) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) Image(javafx.scene.image.Image) ListIterator(java.util.ListIterator) Credits(net.rptools.tokentool.client.Credits) ManageOverlays(net.rptools.tokentool.client.ManageOverlays) Glow(javafx.scene.effect.Glow) Point(java.awt.Point) ImageView_Preferences(net.rptools.tokentool.model.ImageView_Preferences) Task(javafx.concurrent.Task) AlertType(javafx.scene.control.Alert.AlertType) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Gson(com.google.gson.Gson) ImageIO(javax.imageio.ImageIO) RotateEvent(javafx.scene.input.RotateEvent) Pane(javafx.scene.layout.Pane) Alert(javafx.scene.control.Alert) TextField(javafx.scene.control.TextField) MenuItem(javafx.scene.control.MenuItem) BufferedImage(java.awt.image.BufferedImage) NavigableSet(java.util.NavigableSet) Spinner(javafx.scene.control.Spinner) TreeView(javafx.scene.control.TreeView) FXML(javafx.fxml.FXML) Duration(javafx.util.Duration) ImageUtil(net.rptools.tokentool.util.ImageUtil) ToggleButton(javafx.scene.control.ToggleButton) Entry(java.util.Map.Entry) Optional(java.util.Optional) ClipboardContent(javafx.scene.input.ClipboardContent) FilenameUtils(org.apache.commons.io.FilenameUtils) CornerRadii(javafx.scene.layout.CornerRadii) RadioMenuItem(javafx.scene.control.RadioMenuItem) ButtonType(javafx.scene.control.ButtonType) MouseEvent(javafx.scene.input.MouseEvent) AppConstants(net.rptools.tokentool.AppConstants) TokenTool(net.rptools.tokentool.client.TokenTool) Insets(javafx.geometry.Insets) Graphics2D(java.awt.Graphics2D) BackgroundFill(javafx.scene.layout.BackgroundFill) ZoomEvent(javafx.scene.input.ZoomEvent) ExecutorService(java.util.concurrent.ExecutorService) ColorPicker(javafx.scene.control.ColorPicker) Window_Preferences(net.rptools.tokentool.model.Window_Preferences) ObjectProperty(javafx.beans.property.ObjectProperty) Label(javafx.scene.control.Label) MouseDragEvent(javafx.scene.input.MouseDragEvent) ScrollEvent(javafx.scene.input.ScrollEvent) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) AppPreferences(net.rptools.tokentool.AppPreferences) SwingFXUtils(javafx.embed.swing.SwingFXUtils) TreeCell(javafx.scene.control.TreeCell) Comparator(java.util.Comparator) ChangeListener(javafx.beans.value.ChangeListener) LogManager(org.apache.logging.log4j.LogManager) Background(javafx.scene.layout.Background) TreeItem(javafx.scene.control.TreeItem) GaussianBlur(javafx.scene.effect.GaussianBlur) BackgroundFill(javafx.scene.layout.BackgroundFill) Change(javafx.scene.control.TextFormatter.Change) Glow(javafx.scene.effect.Glow) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) FXML(javafx.fxml.FXML)

Example 48 with Background

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

the class JFXSliderSkin method initListeners.

private void initListeners() {
    // delegate slider mouse events to track node 
    getSkinnable().setOnMousePressed(me -> {
        if (!me.isConsumed()) {
            me.consume();
            track.fireEvent(me);
        }
    });
    getSkinnable().setOnMouseReleased(me -> {
        if (!me.isConsumed()) {
            me.consume();
            track.fireEvent(me);
        }
    });
    getSkinnable().setOnMouseDragged(me -> {
        if (!me.isConsumed()) {
            me.consume();
            track.fireEvent(me);
        }
    });
    // animate value node
    track.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> {
        timeline.setRate(1);
        timeline.play();
    });
    track.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> {
        timeline.setRate(-1);
        timeline.play();
    });
    thumb.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> {
        timeline.setRate(1);
        timeline.play();
    });
    thumb.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> {
        timeline.setRate(-1);
        timeline.play();
    });
    track.backgroundProperty().addListener((o, oldVal, newVal) -> {
        // prevent internal color change
        if (!internalChange && newVal != null)
            trackColor = newVal.getFills().get(0).getFill();
    });
    thumb.backgroundProperty().addListener((o, oldVal, newVal) -> {
        // prevent internal color change
        if (!internalChange && newVal != null) {
            thumbColor = newVal.getFills().get(0).getFill();
            if (getSkinnable().getValue() == getSkinnable().getMin()) {
                internalChange = true;
                thumb.setBackground(new Background(new BackgroundFill(trackColor, new CornerRadii(20), Insets.EMPTY)));
                internalChange = false;
            }
        }
    });
    refreshSliderValueBinding();
    getSkinnable().valueProperty().addListener((o, oldVal, newVal) -> {
        internalChange = true;
        if (getSkinnable().getMin() == newVal.doubleValue()) {
            thumb.setBackground(new Background(new BackgroundFill(trackColor, new CornerRadii(20), Insets.EMPTY)));
            animatedThumb.pseudoClassStateChanged(PseudoClass.getPseudoClass("min"), true);
        } else if (oldVal.doubleValue() == getSkinnable().getMin()) {
            thumb.setBackground(new Background(new BackgroundFill(thumbColor, new CornerRadii(20), Insets.EMPTY)));
            animatedThumb.pseudoClassStateChanged(PseudoClass.getPseudoClass("min"), false);
        }
        internalChange = false;
    });
    getSkinnable().orientationProperty().addListener((o, oldVal, newVal) -> initAnimation(newVal));
    animatedThumb.layoutBoundsProperty().addListener((o, oldVal, newVal) -> initAnimation(getSkinnable().getOrientation()));
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 49 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 50 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)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