Java 类javafx.scene.layout.PaneBuilder 实例源码

项目:openjfx-8u-dev-tests    文件:ControlsCssStylesFactory.java   
@Override
public void decorate(Node control, Pane container) {
    super.decorate(control, container);
    if (control instanceof VBox) {
        VBox box = (VBox) control;
        box.getChildren().clear();
        box.setStyle(box.getStyle() + "-fx-border-color:blue;");
        box.getChildren().add(PaneBuilder.create().children(new Rectangle(20, 20, Color.TRANSPARENT)).style("-fx-border-color:red;").build());
    }
}
项目:openjfx-8u-dev-tests    文件:ControlsCssStylesFactory.java   
@Override
public void decorate(Node control, Pane container) {
    super.decorate(control, container);
    if (control instanceof HBox) {
        HBox box = (HBox) control;
        box.getChildren().clear();
        box.setStyle(box.getStyle() + "-fx-border-color:blue;");
        box.getChildren().add(PaneBuilder.create().children(new Rectangle(20, 20, Color.TRANSPARENT)).style("-fx-border-color:red;").build());
    }
}
项目:rapfx    文件:JfxShell.java   
private void createResizeHandles(Pane parent) {
    PaneBuilder<?> horizBuilder = PaneBuilder.create().prefHeight(RESIZE_HANDLE_WIDTH)
            .layoutX(0).layoutY(0).cursor(Cursor.S_RESIZE).mouseTransparent(false);
    PaneBuilder<?> vertBuilder = PaneBuilder.create().prefWidth(RESIZE_HANDLE_WIDTH).layoutX(0)
            .layoutY(0).cursor(Cursor.E_RESIZE).mouseTransparent(false);

    resizeSouth = horizBuilder.build();
    resizeSouth.prefWidthProperty().bind(parent.widthProperty());
    resizeSouth.layoutYProperty().bind(parent.heightProperty().subtract(RESIZE_HANDLE_WIDTH));

    resizeNorth = horizBuilder.build();
    resizeNorth.prefWidthProperty().bind(parent.widthProperty());

    resizeEast = vertBuilder.build();
    resizeEast.prefHeightProperty().bind(parent.heightProperty());
    resizeEast.layoutXProperty().bind(parent.widthProperty().subtract(RESIZE_HANDLE_WIDTH));

    resizeWest = vertBuilder.build();
    resizeWest.prefHeightProperty().bind(parent.heightProperty());

    resizeSouthEast = PaneBuilder.create().prefHeight(RESIZE_HANDLE_WIDTH * 2)
            .prefWidth(RESIZE_HANDLE_WIDTH * 2).cursor(Cursor.SE_RESIZE)
            .mouseTransparent(false).build();
    resizeSouthEast.layoutXProperty().bind(
            parent.widthProperty().subtract(RESIZE_HANDLE_WIDTH * 2));
    resizeSouthEast.layoutYProperty().bind(
            parent.heightProperty().subtract(RESIZE_HANDLE_WIDTH * 2));

    parent.getChildren().addAll(resizeSouth, resizeNorth, resizeEast, resizeWest,
            resizeSouthEast);

    new ResizeDragHandler(resizeNorth);
    new ResizeDragHandler(resizeEast);
    new ResizeDragHandler(resizeSouthEast);
    new ResizeDragHandler(resizeSouth);
    new ResizeDragHandler(resizeWest);

    updateResizeHandles();
}
项目:openjfx-8u-dev-tests    文件:AnimationLCDTextTestApp.java   
@Override
public void start(Stage primaryStage) {


    final TextArea testText = TextAreaBuilder.create()
            .text("Test")
            .prefHeight(50)
            .prefWidth(500)
            .build();

    final ChoiceBox<Interpolator> interpolatorChoiceBox = new ChoiceBox<Interpolator>();
    interpolatorChoiceBox.getItems().addAll(FXCollections.observableArrayList(
                Interpolator.LINEAR,
                Interpolator.DISCRETE,
                Interpolator.EASE_BOTH,
                Interpolator.EASE_IN,
                Interpolator.EASE_OUT
                ));
    interpolatorChoiceBox.setPrefHeight(25);
    interpolatorChoiceBox.setPrefWidth(500);

    interpolatorChoiceBox.getSelectionModel().selectFirst();


    final Text lcdText = TextBuilder.create()
            .x(100)
            .y(100)
            .fontSmoothingType(FontSmoothingType.LCD)
            .build();

    lcdText.textProperty().bind(testText.textProperty());

    final Circle point = CircleBuilder.create()
            .centerX(100)
            .centerY(100)
            .radius(2)
            .fill(Color.RED)
            .build();

    Pane root = VBoxBuilder.create()
            .children(
                PaneBuilder.create()
                .minWidth(500)
                .minHeight(500)
                .children(
                    lcdText,
                    point)
                .onMouseClicked(new EventHandler<MouseEvent>() {

                    @Override
                    public void handle(MouseEvent event) {
                        point.setCenterX(event.getX());
                        point.setCenterY(event.getY());

                        TimelineBuilder.create()
                            .keyFrames(
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.xProperty(), event.getX(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem())),
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.yProperty(), event.getY(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem()))
                                )
                            .build()
                            .play();
                    }
                })
                .build(),
                testText,
                interpolatorChoiceBox)
            .build();



    Scene scene = new Scene(root, 500, 575);

    primaryStage.setTitle("Test Animnation LCD Text");
    primaryStage.setResizable(false);
    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:simplejavayoutubeuploader    文件:AccountListCellRenderer.java   
@Override
protected void updateItem(final Account item, final boolean empty) {
    super.updateItem(item, empty);
    if (null == item) {
        return;
    }

    //Load data from database and construct checkboxes
    final ArrayList<CheckBox> children = new ArrayList<>(item.getPlaylists().size());
    for (final Playlist playlist : item.getPlaylists()) {
        children.add(CheckBoxBuilder.create()
                .text(playlist.getTitle())
                .selected(playlist.isHidden())
                .styleClass("accountCellCheckbox")
                .onAction(new AccountCellCheckboxHandler(playlist))
                .build());
    }

    //Create our main view elements
    final TextField nameTextField = TextFieldBuilder.create().text(item.getName()).prefWidth(300).build();
    final Button removeAccountButton = ButtonBuilder.create()
            .text(resources.getString("button.remove"))
            .styleClass("accountCellRemoveButton")
            .onAction(new AccountCellRemoveButtonHandler(item))
            .build();
    final Label playlistLabel = LabelBuilder.create()
            .text(resources.getString("label.hiddenplaylists"))
            .styleClass("accountCellHiddenPlaylistsLabel")
            .build();
    final VBox playlistContainer = VBoxBuilder.create()
            .children(children)
            .styleClass("accountCellHiddenPlaylistsContainer")
            .build();
    final Pane container = PaneBuilder.create()
            .children(nameTextField, removeAccountButton, playlistLabel, playlistContainer)
            .styleClass("accountCellContainer")
            .build();

    nameTextField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(final ObservableValue<? extends Boolean> observableValue, final Boolean oldFocusState, final Boolean newFocusState) {
            if (null != newFocusState && !newFocusState && !item.getName().equals(nameTextField.getText())) {
                item.setName(nameTextField.getText());
                accountService.update(item);
            }
        }
    });

    //Position our elements
    removeAccountButton.layoutXProperty()
            .bind(nameTextField.layoutXProperty().add(nameTextField.widthProperty()).add(10));
    playlistLabel.layoutXProperty()
            .bind(removeAccountButton.layoutXProperty().add(removeAccountButton.widthProperty()).add(10));
    playlistContainer.layoutXProperty()
            .bind(playlistLabel.layoutXProperty().add(playlistLabel.widthProperty()).add(10));
    setGraphic(container);
}