Search in sources :

Example 51 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class IconsListElementSkin method createMiniature.

/**
 * Creates a region with the miniature of the list element
 *
 * @return A region with the miniature of the list element
 */
private Region createMiniature() {
    final Region miniature = new Region();
    miniature.getStyleClass().add("iconListMiniatureImage");
    miniature.styleProperty().bind(Bindings.createStringBinding(() -> String.format("-fx-background-image: url(\"%s\");", getControl().getMiniatureUri().toString()), getControl().miniatureUriProperty()));
    final Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(getControl().titleProperty());
    Tooltip.install(miniature, tooltip);
    // set a gray filter for this element if it is not enabled
    getControl().enabledProperty().addListener((Observable invalidation) -> updateEnabled(miniature));
    // adopt the enable status during initialisation
    updateEnabled(miniature);
    return miniature;
}
Also used : Tooltip(javafx.scene.control.Tooltip) Region(javafx.scene.layout.Region) Observable(javafx.beans.Observable)

Example 52 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class StepRepresentationSpin method drawStepContent.

@Override
protected void drawStepContent() {
    super.drawStepContent();
    Region spacerAbove = new Region();
    VBox.setVgrow(spacerAbove, Priority.ALWAYS);
    this.addToContentPane(spacerAbove);
    ProgressIndicator progressIndicator = new ProgressIndicator();
    this.addToContentPane(progressIndicator);
    Region spacerBelow = new Region();
    VBox.setVgrow(spacerBelow, Priority.ALWAYS);
    this.addToContentPane(spacerBelow);
}
Also used : ProgressIndicator(javafx.scene.control.ProgressIndicator) Region(javafx.scene.layout.Region)

Example 53 with Region

use of javafx.scene.layout.Region in project NMEAParser by tvesalainen.

the class ResizableCanvas method setParent.

private void setParent(ObservableValue<? extends Parent> observable, Parent oldValue, Parent newParent) {
    if (newParent instanceof Region) {
        Region region = (Region) newParent;
        ReadOnlyDoubleProperty regionWidth = region.widthProperty();
        ReadOnlyDoubleProperty regionHeight = region.heightProperty();
        if (square) {
            widthProperty().bind(new When(regionWidth.lessThanOrEqualTo(regionHeight)).then(regionWidth).otherwise(regionHeight));
            heightProperty().bind(new When(regionHeight.lessThanOrEqualTo(regionWidth)).then(regionHeight).otherwise(regionWidth));
        } else {
            widthProperty().bind(regionWidth);
            heightProperty().bind(regionHeight);
        }
    } else {
        System.err.println(newParent + " not suitable for ResizableCanvas");
    }
}
Also used : ReadOnlyDoubleProperty(javafx.beans.property.ReadOnlyDoubleProperty) When(javafx.beans.binding.When) Region(javafx.scene.layout.Region)

Example 54 with Region

use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.

the class LibraryPanel method setShortcutDTO.

public void setShortcutDTO(ShortcutDTO shortcutDTO) {
    this.setTitle(shortcutDTO.getName());
    this.getChildren().clear();
    final VBox vBox = new VBox();
    Label description = new Label(shortcutDTO.getDescription());
    description.setWrapText(true);
    final GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("grid");
    try {
        LOGGER.info("Reading shortcut: {}", shortcutDTO.getScript());
        final Map<String, Object> shortcutProperties = objectMapper.readValue(shortcutDTO.getScript(), new TypeReference<Map<String, Object>>() {
        });
        int i = 0;
        for (String shortcutKey : shortcutProperties.keySet()) {
            final Label keyLabel = new Label(tr(unCamelize(shortcutKey)) + ":");
            keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
            GridPane.setValignment(keyLabel, VPos.TOP);
            gridPane.add(keyLabel, 0, i);
            final Label valueLabel = new Label(shortcutProperties.get(shortcutKey).toString());
            valueLabel.setWrapText(true);
            gridPane.add(valueLabel, 1, i);
            i++;
        }
    } catch (IOException e) {
        LOGGER.warn("Could not parse shortcut script JSON", e);
    }
    gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    Region spacer = new Region();
    spacer.setPrefHeight(40);
    HBox buttons = new HBox();
    buttons.setAlignment(Pos.CENTER);
    Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> onShortcutRun.accept(shortcutDTO));
    Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> onShortcutStop.accept(shortcutDTO));
    Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> onShortcutUninstall.accept(shortcutDTO));
    buttons.getChildren().addAll(runButton, stopButton, uninstallButton);
    vBox.getChildren().addAll(description, gridPane, spacer, buttons);
    this.setCenter(vBox);
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) IOException(java.io.IOException) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) Button(javafx.scene.control.Button) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Map(java.util.Map)

Example 55 with Region

use of javafx.scene.layout.Region in project fxexperience2 by EricCanull.

the class DerivationController method initialize.

@Override
public void initialize(URL url, ResourceBundle rb) {
    gridPane.getChildren().addAll(baseColorPicker, desiredColorPicker);
    GridPane.setConstraints(baseColorPicker, 1, 1);
    baseColorPicker.setPrefWidth(120);
    baseColorPicker.setMaxWidth(120);
    GridPane.setConstraints(desiredColorPicker, 1, 6);
    desiredColorPicker.setPrefWidth(120);
    desiredColorPicker.setMaxWidth(120);
    // FORWARD
    forwardDerivationLabel.textProperty().bind(new StringBinding() {

        {
            bind(derivationSlider.valueProperty());
        }

        @Override
        protected String computeValue() {
            return String.format("%3.1f%%", derivationSlider.getValue());
        }
    });
    Region derivedResultColor = new Region();
    derivedResultColor.setPrefSize(50, 20);
    derivedResultLabel.setGraphic(derivedResultColor);
    derivedResultColor.styleProperty().bind(new StringBinding() {

        {
            bind(derivationSlider.valueProperty(), baseColorPicker.colorProperty());
        }

        @Override
        protected String computeValue() {
            return "-fx-border-color: black; -fx-background-color: derive(" + baseColorPicker.getWebColor() + ", " + derivationSlider.getValue() + "%);";
        }
    });
    derivedResultLabel.textProperty().bind(new StringBinding() {

        {
            bind(derivationSlider.valueProperty(), baseColorPicker.colorProperty());
        }

        @Override
        protected String computeValue() {
            Color base = baseColorPicker.getColor();
            double derivation = derivationSlider.getValue();
            Color result = ColorEncoder.deriveColor(base, derivation / 100);
            return getColorString(result);
        }
    });
    // BACKWARD
    reverseResultColor = new Region();
    reverseResultColor.setPrefSize(50, 20);
    reverseResultLabel.setGraphic(reverseResultColor);
    ChangeListener<Color> updateReverse = (ObservableValue<? extends Color> ov, Color t, Color desiredColor) -> {
        updateReverse();
    };
    baseColorPicker.colorProperty().addListener(updateReverse);
    desiredColorPicker.colorProperty().addListener(updateReverse);
}
Also used : StringBinding(javafx.beans.binding.StringBinding) Color(javafx.scene.paint.Color) Region(javafx.scene.layout.Region)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8