BaseInfoTab() { setClosable(false); grid.getStyleClass().add("info-props"); grid.setAlignment(Pos.TOP_CENTER); ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); ColumnConstraints column2 = new ColumnConstraints(); column2.setPercentWidth(75); grid.getColumnConstraints().addAll(column1, column2); ScrollPane scroll = new ScrollPane(grid); scroll.setFitToHeight(true); scroll.setFitToWidth(true); setContent(scroll); }
/** * Creates the grid pane which will contain the node. * * @return a {@link GridPane} */ private static GridPane createGridPane() { GridPane pane = new GridPane(); pane.setAlignment(Pos.CENTER); return pane; }
grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10);
private GridPane createGrid() { GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); return grid; } }
root.addRow(2, new Label("Tax due:"), taxLabel); root.setAlignment(Pos.CENTER);
pane.setAlignment(Pos.CENTER);
grid.setVgap(10); grid.setAlignment(Pos.CENTER);
boardGame.setAlignment(Pos.CENTER); Collection<StackPane> stackPanes = new ArrayList<StackPane>(); for(int row = 0; row < maxRows ; row++)
pane.setAlignment(Pos.CENTER); pane.setStyle("-fx-background-color: black"); pane.getChildren().add(phrase);
grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10);
public SimpleForm() { setSpacing(12); titlePane = new AnchorPane(); titlePane.getStyleClass().add("datafx-form-title"); titleLabel = new Label(); titleLabel.getStyleClass().add("datafx-form-title-label"); AnchorPane.setLeftAnchor(titleLabel, 12.0); AnchorPane.setTopAnchor(titleLabel, 6.0); AnchorPane.setBottomAnchor(titleLabel, 6.0); titlePane.getChildren().add(titleLabel); titlePane.setVisible(false); getChildren().add(titlePane); mainPane = new GridPane(); mainPane.setAlignment(Pos.CENTER_RIGHT); mainPane.setHgap(12.0); mainPane.setVgap(6.0); VBox.setMargin(mainPane, new Insets(0, 16, 0, 16)); getChildren().add(mainPane); actionPane = new FlowPane(); actionPane.setAlignment(Pos.CENTER_RIGHT); actionPane.setHgap(6.0); VBox.setMargin(actionPane, new Insets(0, 16, 12, 16)); getChildren().add(actionPane); }
public SimpleForm() { setSpacing(12); titlePane = new AnchorPane(); titlePane.getStyleClass().add("datafx-form-title"); titleLabel = new Label(); titleLabel.getStyleClass().add("datafx-form-title-label"); AnchorPane.setLeftAnchor(titleLabel, 12.0); AnchorPane.setTopAnchor(titleLabel, 6.0); AnchorPane.setBottomAnchor(titleLabel, 6.0); titlePane.getChildren().add(titleLabel); titlePane.setVisible(false); getChildren().add(titlePane); mainPane = new GridPane(); mainPane.setAlignment(Pos.CENTER_RIGHT); mainPane.setHgap(12.0); mainPane.setVgap(6.0); VBox.setMargin(mainPane, new Insets(0, 16, 0, 16)); getChildren().add(mainPane); actionPane = new FlowPane(); actionPane.setAlignment(Pos.CENTER_RIGHT); actionPane.setHgap(6.0); VBox.setMargin(actionPane, new Insets(0, 16, 12, 16)); getChildren().add(actionPane); }
import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class UnfocusTextField extends Application { @Override public void start(Stage primaryStage) { GridPane root = new GridPane(); root.setOnMousePressed(e -> root.requestFocus()); root.setAlignment(Pos.CENTER); root.setHgap(10); root.setVgap(10); for (int i = 0 ; i < 10; i++) { root.add(new TextField(), i % 2, i / 2 ); } Scene scene = new Scene(root, 600, 600); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
primaryStage.setTitle("Enter number and hit the button"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); Label label1To6 = new Label("1.0-6.0:"); grid.add(label1To6, 0, 1);
GridPane root = new GridPane(); root.setAlignment(Pos.TOP_LEFT); root.setHgap(10); root.setVgap(10); root.setPadding(new Insets(50, 50, 50, 50)); //Add each element to the GridPane //.add(element, column, row ,column span, row span) span must be >0 //row 0 root.add(sourceDirLabel, 0, 0, 2, 1); //row1 root.add(sourceDirText,0, 1, 3, 1); root.add(sourceDirBtn, 3, 1); //row 2 root.add(outputDirLabel, 0, 2, 2, 1); //row3 root.add(outputDirText,0, 3, 3, 1); root.add(outputDirBtn, 3, 3); //row4 root.add(runBtn, 0 , 4);
grid.setAlignment(Pos.CENTER); grid.getColumnConstraints().add(new ColumnConstraints(200)); // column 1 grid.getColumnConstraints().add(new ColumnConstraints(300)); // column 2
dialogStage = new Stage(); GridPane grd_pan = new GridPane(); grd_pan.setAlignment(Pos.CENTER); grd_pan.setHgap(10); grd_pan.setVgap(10);//pading
/** * @return menu content containing input mappings (action -> key/mouse) */ protected final MenuContent createContentControls() { log.debug("createContentControls()"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(10, 10, 10, 10)); grid.getColumnConstraints().add(new ColumnConstraints(200, 200, 200, Priority.ALWAYS, HPos.LEFT, true)); grid.getRowConstraints().add(new RowConstraints(40, 40, 40, Priority.ALWAYS, VPos.CENTER, true)); // row 0 grid.setUserData(0); forEach(app.getInput().getBindings(), (action, trigger) -> addNewInputBinding(action, trigger, grid)); ScrollPane scroll = new FXGLScrollPane(grid); scroll.setVbarPolicy(ScrollBarPolicy.ALWAYS); scroll.setMaxHeight(app.getHeight() / 2.5); HBox hbox = new HBox(scroll); hbox.setAlignment(Pos.CENTER); return new MenuContent(hbox); }
stage.setTitle("How to bind tooltip to focus event?"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(5);
@Override public Node createValueVisualisation() { GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER_LEFT); grid.setHgap(6); grid.setVgap(6);