Search in sources :

Example 21 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bisq-desktop by bisq-network.

the class ArbitratorSelectionView method addLanguageGroup.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI builder
// /////////////////////////////////////////////////////////////////////////////////////////
private void addLanguageGroup() {
    addTitledGroupBg(root, gridRow, 1, Res.get("account.arbitratorSelection.whichLanguages"));
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("shared.yourLanguage"), Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    // noinspection unchecked
    languagesListView = tuple.second;
    languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {

        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ListCell<String>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(LanguageUtil.getDisplayName(item));
                        removeButton.setOnAction(e -> onRemoveLanguage(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    // noinspection unchecked
    languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
    languageComboBox.setPromptText(Res.get("shared.addLanguage"));
    languageComboBox.setConverter(new StringConverter<String>() {

        @Override
        public String toString(String code) {
            return LanguageUtil.getDisplayName(code);
        }

        @Override
        public String fromString(String s) {
            return null;
        }
    });
    languageComboBox.setOnAction(e -> onAddLanguage());
}
Also used : TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) TableCell(javafx.scene.control.TableCell) FormBuilder.addLabelComboBox(bisq.desktop.util.FormBuilder.addLabelComboBox) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) VPos(javafx.geometry.VPos) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) GridPane(javafx.scene.layout.GridPane) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) Popup(bisq.desktop.main.overlays.popups.Popup) Label(javafx.scene.control.Label) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableRow(javafx.scene.control.TableRow) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) CheckBox(javafx.scene.control.CheckBox) StringConverter(javafx.util.StringConverter) FormBuilder.addCheckBox(bisq.desktop.util.FormBuilder.addCheckBox) BooleanProperty(javafx.beans.property.BooleanProperty) ImageUtil(bisq.desktop.util.ImageUtil) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) LanguageUtil(bisq.core.locale.LanguageUtil) UserThread(bisq.common.UserThread) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) AutoTooltipCheckBox(bisq.desktop.components.AutoTooltipCheckBox) ChangeListener(javafx.beans.value.ChangeListener) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ListView(javafx.scene.control.ListView) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane)

Example 22 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bisq-desktop by bisq-network.

the class TradeSubView method addContentPane.

private void addContentPane() {
    contentPane = new AnchorPane();
    HBox.setHgrow(contentPane, Priority.SOMETIMES);
    getChildren().add(contentPane);
}
Also used : AnchorPane(javafx.scene.layout.AnchorPane)

Example 23 with AnchorPane

use of javafx.scene.layout.AnchorPane in project org.csstudio.display.builder by kasemir.

the class SymbolRepresentation method createJFXNode.

@Override
protected AnchorPane createJFXNode() throws Exception {
    autoSize = model_widget.propAutoSize().getValue();
    if (autoSize) {
        model_widget.propWidth().setValue((int) Math.round(maxSize.getWidth()));
        model_widget.propHeight().setValue((int) Math.round(maxSize.getHeight()));
    }
    AnchorPane symbol = new AnchorPane();
    imagePane = new BorderPane();
    imageView = new ImageView();
    setImageIndex(Math.min(Math.max(model_widget.propInitialIndex().getValue(), 0), imagesList.size() - 1));
    imageView.setPreserveRatio(model_widget.propPreserveRatio().getValue());
    imageView.setSmooth(true);
    imageView.fitHeightProperty().bind(symbol.prefHeightProperty());
    imageView.fitWidthProperty().bind(symbol.prefWidthProperty());
    imageView.imageProperty().bind(Bindings.createObjectBinding(() -> (getImageIndex() >= 0) ? imagesList.get(getImageIndex()) : getDefaultSymbol(), imageIndexProperty()));
    imagePane.setCenter(imageView);
    imagePane.setPrefWidth(model_widget.propWidth().getValue());
    imagePane.setPrefHeight(model_widget.propHeight().getValue());
    imagePane.setRotate(model_widget.propRotation().getValue());
    AnchorPane.setLeftAnchor(imagePane, 0.0);
    AnchorPane.setRightAnchor(imagePane, 0.0);
    AnchorPane.setTopAnchor(imagePane, 0.0);
    AnchorPane.setBottomAnchor(imagePane, 0.0);
    BorderPane circlePane = new BorderPane();
    indexLabelBackground = new Circle(16.0, Color.BLACK.deriveColor(0.0, 0.0, 0.0, 0.75));
    indexLabelBackground.setStroke(Color.LIGHTGRAY.deriveColor(0.0, 1.0, 1.0, 0.75));
    indexLabelBackground.setVisible(model_widget.propShowIndex().getValue());
    circlePane.setCenter(indexLabelBackground);
    AnchorPane.setLeftAnchor(circlePane, 0.0);
    AnchorPane.setRightAnchor(circlePane, 0.0);
    AnchorPane.setTopAnchor(circlePane, 0.0);
    AnchorPane.setBottomAnchor(circlePane, 0.0);
    indexLabel = new Label();
    indexLabel.setAlignment(Pos.CENTER);
    indexLabel.setFont(Font.font(indexLabel.getFont().getFamily(), FontWeight.BOLD, 16));
    indexLabel.setTextFill(Color.WHITE);
    indexLabel.setVisible(model_widget.propShowIndex().getValue());
    indexLabel.textProperty().bind(Bindings.convert(imageIndexProperty()));
    AnchorPane.setLeftAnchor(indexLabel, 0.0);
    AnchorPane.setRightAnchor(indexLabel, 0.0);
    AnchorPane.setTopAnchor(indexLabel, 0.0);
    AnchorPane.setBottomAnchor(indexLabel, 0.0);
    symbol.getChildren().addAll(imagePane, circlePane, indexLabel);
    if (model_widget.propTransparent().getValue()) {
        symbol.setBackground(null);
    } else {
        symbol.setBackground(new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY)));
    }
    enabled = model_widget.propEnabled().getValue();
    Styles.update(symbol, Styles.NOT_ENABLED, !enabled);
    imageChanged(null, null, null);
    return symbol;
}
Also used : Circle(javafx.scene.shape.Circle) BorderPane(javafx.scene.layout.BorderPane) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Example 24 with AnchorPane

use of javafx.scene.layout.AnchorPane in project blue by kunstmusik.

the class SimpleCSSEditor method editCSS.

public static void editCSS(Node node) {
    // StyleManager.getInstance().addUserAgentStylesheet(null);
    FXMLLoader loader = new FXMLLoader(SimpleCSSEditor.class.getResource("SimpleCSSEditor.fxml"));
    try {
        AnchorPane pane = loader.load();
        SimpleCSSEditorController controller = loader.getController();
        Stage stage = new Stage();
        stage.setScene(new Scene(pane));
        stage.setAlwaysOnTop(true);
        stage.show();
        controller.setNode(node);
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : Stage(javafx.stage.Stage) IOException(java.io.IOException) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane)

Example 25 with AnchorPane

use of javafx.scene.layout.AnchorPane in project RIS-PACS by KyleRemil.

the class Main method start.

@Override
public void start(Stage primaryStage) {
    try {
        AnchorPane root = (AnchorPane) FXMLLoader.load(getClass().getResource("../com/rispacs/view/LoginView.fxml"));
        Scene scene = new Scene(root);
        scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)66 IOException (java.io.IOException)26 Scene (javafx.scene.Scene)23 FXMLLoader (javafx.fxml.FXMLLoader)22 ChangeListener (javafx.beans.value.ChangeListener)18 Label (javafx.scene.control.Label)16 ImageView (javafx.scene.image.ImageView)16 FXML (javafx.fxml.FXML)15 Insets (javafx.geometry.Insets)15 Pane (javafx.scene.layout.Pane)14 URL (java.net.URL)13 GridPane (javafx.scene.layout.GridPane)12 Inject (javax.inject.Inject)12 JFXButton (com.jfoenix.controls.JFXButton)11 ResourceBundle (java.util.ResourceBundle)11 KeyFrame (javafx.animation.KeyFrame)11 Timeline (javafx.animation.Timeline)11 Initializable (javafx.fxml.Initializable)11 Duration (javafx.util.Duration)11 Button (javafx.scene.control.Button)10