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

项目:LJGM    文件:ViewingArea.java   
/**
 * Instantiates a new ViewingArea with a given focus.
 * 
 * @param ljgm
 *            The ljgm
 * @param g
 *            The default focus of this {@link ViewingArea}.
 */
public ViewingArea(LJGM ljgm, Gallery g) {
    this.focus = g;
    this.imageQueue = new ImageLoaderQueue();
    this.grid = GridPaneBuilder.create().padding(new Insets(PADDING)).hgap(PADDING).vgap(PADDING).build();

    LJGM.instance().getStatusBar().bindProgress(imageQueue.progressProperty());

    if (g == null) {
        setCenter(getBlankDisplay("There are no galleries!"));
        return;
    } else {
        setFocus(g);
        return;
    }
}
项目:rapfx    文件:JfxShell.java   
private void createTitleBar(Pane parent, JfxStyleHolder style) {
    Integer height = ThemeTypeHelper.toDimension(Handler.tbHeightAttr.getRawValue(getTheme()));

    if (height == null || height < MIN_TITLE_HEIGHT) {
        height = MIN_TITLE_HEIGHT;
    }

    title = GridPaneBuilder.create().layoutX(border.width).layoutY(border.width)
            .prefHeight(height).build();
    title.getStyleClass().add(TITLE_BAR_CLASS);
    title.prefWidthProperty().bind(parent.widthProperty().subtract(border.width * 2));
    createTitleDragHandlers(title);
    parent.getChildren().add(title);

    // create real contents
    createTitleLabel(title);
    createTitleButtons(title, style);
}
项目:javafx-demos    文件:TableViewMemoryLeakFix.java   
private GridPane configureMemoryAnalyzer() {
    GridPane gp = GridPaneBuilder.create().vgap(8).hgap(8).build();
    Label usedLbl = LabelBuilder.create().build();
    Label freeLbl = LabelBuilder.create().build();
    Label totalLbl = LabelBuilder.create().build();
    Label maxLbl = LabelBuilder.create().build();

    gp.addRow(0, new Label("Used  :"), usedLbl);
    gp.addRow(1, new Label("Free  :"), freeLbl);
    gp.addRow(2, new Label("Total :"), totalLbl);
    gp.addRow(3, new Label("Max   :"), maxLbl);
    read(usedLbl, freeLbl, totalLbl, maxLbl);
    return gp;
}
项目:javafx-demos    文件:ImageLayoutsDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    // Logic starts
    propScroll = ScrollPaneBuilder.create().fitToHeight(true).fitToWidth(true).build();
    dock.getChildren().add(image);
    SplitPane sp = new SplitPane();
    sp.getItems().addAll(dock,propScroll);

    GridPane gp = GridPaneBuilder.create().vgap(10).hgap(10).padding(new Insets(10)).build();
    propScroll.setContent(gp);
    root.getChildren().add(sp);

    gp.addRow(0, new Label("X : "),getBindedTextField(image.xProperty()));
    gp.addRow(1, new Label("Y : "),getBindedTextField(image.yProperty()));
    gp.addRow(2, new Label("Layout-X : "),getBindedTextField(image.layoutXProperty()));
    gp.addRow(3, new Label("Layout-Y : "),getBindedTextField(image.layoutYProperty()));
    gp.addRow(4, new Label("Translate-X : "),getBindedTextField(image.translateXProperty()));
    gp.addRow(5, new Label("Translate-Y : "),getBindedTextField(image.translateYProperty()));

    gp.addRow(6, new Label("Fit Width : "),getBindedTextField(image.fitWidthProperty()));
    gp.addRow(7, new Label("Fit Height : "),getBindedTextField(image.fitHeightProperty()));
    gp.addRow(8, new Label("Scale-X : "),getBindedTextField(image.scaleXProperty()));
    gp.addRow(9, new Label("Scale-Y : "),getBindedTextField(image.scaleYProperty()));

    CheckBox cb = new CheckBox();
    image.preserveRatioProperty().bindBidirectional(cb.selectedProperty());
    gp.addRow(10, new Label("Preserve ratio : "),cb);
    }
项目:javafx-demos    文件:DynamicTextAreaDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    // Logic starts
    VBox vb = new VBox();
    vb.setSpacing(10);

    final VBox layout = VBoxBuilder.create().build();
    layout.getChildren().add(new DynamicTextArea());

    Button btn = ButtonBuilder.create().text("Add").onAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent arg0) {
            layout.getChildren().add(new DynamicTextArea());
        }
    }).build();

    final GridPane gridPane = GridPaneBuilder.create()
            .styleClass("contact-details-gridpane")
            // [ARE] Further modification for CAEMR-2098. Setting minimum width to show labels even if application width is changed.
            .columnConstraints(ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(80).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.ALWAYS).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(100).build()).build();

    gridPane.addRow(0, new Label("hi"), layout, btn);

    root.getChildren().add(ScrollPaneBuilder.create().styleClass("contact-details-pane").hbarPolicy(ScrollBarPolicy.NEVER)
            .fitToWidth(true).content(gridPane).build());
}
项目:JacpFX-misc    文件:PerspectiveTwo.java   
@Override
public void handlePerspective(final IAction<Event, Object> action,
        final PerspectiveLayout perspectiveLayout) {
    if (action.getLastMessage().equals(MessageUtil.INIT)) {
        final SplitPane mainLayout = SplitPaneBuilder.create()
                .styleClass("vsplitpane").orientation(Orientation.VERTICAL)
                .prefHeight(600).prefWidth(800).build();

        mainLayout.setDividerPosition(0, 0.50f);

        // create left button menu
        final GridPane top = GridPaneBuilder.create()
                .alignment(Pos.TOP_CENTER).build();
        GridPane.setHgrow(top, Priority.ALWAYS);
        GridPane.setVgrow(top, Priority.ALWAYS);

        // create main content Top
        final GridPane bottom = GridPaneBuilder.create()
                .alignment(Pos.BOTTOM_CENTER).build();
        GridPane.setHgrow(bottom, Priority.ALWAYS);
        GridPane.setVgrow(bottom, Priority.ALWAYS);

        GridPane.setVgrow(mainLayout, Priority.ALWAYS);
        GridPane.setHgrow(mainLayout, Priority.ALWAYS);

        mainLayout.getItems().addAll(top, bottom);
        // Register root component
        perspectiveLayout.registerRootComponent(mainLayout);
        // register left menu
        perspectiveLayout.registerTargetLayoutComponent("PTop", top);
        // register main content
        perspectiveLayout.registerTargetLayoutComponent("PBottom", bottom);
    }

}