List of usage examples for javafx.scene.layout GridPane setHgap
public final void setHgap(double value)
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 130, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);/*ww w. j a v a 2 s. c om*/ Label label = new Label("Label"); GridPane.setHalignment(label, HPos.CENTER); gridpane.add(label, 0, 0); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);/*from w ww . j a v a 2s.c o m*/ Label label = new Label("Label"); GridPane.setHalignment(label, HPos.CENTER); gridpane.add(label, 0, 0); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Borders"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);//w w w. j av a2s .co m final String cssDefault = "-fx-border-color: blue;\n" + "-fx-border-insets: 5;\n" + "-fx-border-width: 3;\n" + "-fx-border-style: dashed;\n"; final HBox pictureRegion = new HBox(); pictureRegion.setStyle(cssDefault); gridpane.add(pictureRegion, 1, 1, 10, 10); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);/*from ww w .j a va2s .co m*/ final ImageView imv = new ImageView(); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) throws Exception { genderFld.getItems().addAll("Male", "Fenale", "Unknwon"); dataFld.setPrefColumnCount(30);/*from w ww . j ava2 s .com*/ dataFld.setPrefRowCount(5); GridPane grid = new GridPane(); grid.setHgap(5); grid.setVgap(5); // Place the controls in the grid grid.add(fNameLbl, 0, 0); // column=0, row=0 grid.add(lNameLbl, 0, 1); // column=0, row=1 grid.add(bDateLbl, 0, 2); // column=0, row=2 grid.add(genderLbl, 0, 3); // column=0, row=3 grid.add(fNameFld, 1, 0); // column=1, row=0 grid.add(lNameFld, 1, 1); // column=1, row=1 grid.add(bDateFld, 1, 2); // column=1, row=2 grid.add(genderFld, 1, 3); // column=1, row=3 grid.add(dataFld, 1, 4, 3, 2); // column=1, row=4, colspan=3, rowspan=3 VBox buttonBox = new VBox(saveBtn, closeBtn); saveBtn.setMaxWidth(Double.MAX_VALUE); closeBtn.setMaxWidth(Double.MAX_VALUE); grid.add(buttonBox, 2, 0, 1, 2); // column=2, row=0, colspan=1, rowspan=2 saveBtn.setOnAction(e -> showData()); closeBtn.setOnAction(e -> stage.hide()); Scene scene = new Scene(grid); stage.setScene(scene); stage.setTitle("Person Details"); stage.sizeToScene(); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);/*from www .java 2s. c o m*/ final ImageView imv = new ImageView(); imv.setFitWidth(100); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);//from www . j a v a 2s . co m final ImageView imv = new ImageView(); imv.setPreserveRatio(true); final Image image2 = new Image(Main.class.getResourceAsStream("button.png")); imv.setImage(image2); final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Title"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);//from w w w.j a v a 2s. c om final ImageView imv = new ImageView(); final Image image2 = new Image(Main.class.getResourceAsStream("a.jpg")); imv.setImage(image2); imv.setEffect(new SepiaTone()); // default is full (1.0) effect final HBox pictureRegion = new HBox(); pictureRegion.getChildren().add(imv); gridpane.add(pictureRegion, 1, 1); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Borders"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10); gridpane.setVgap(10);/*from w ww . j a v a 2 s . c o m*/ final TextArea cssEditorFld = new TextArea(); cssEditorFld.setPrefRowCount(10); cssEditorFld.setPrefColumnCount(100); cssEditorFld.setWrapText(true); cssEditorFld.setPrefWidth(150); GridPane.setHalignment(cssEditorFld, HPos.CENTER); gridpane.add(cssEditorFld, 0, 1); String cssDefault = "line1;\nline2;\n"; cssEditorFld.setText(cssDefault); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TextField notification = new TextField(); MenuItem item1 = new MenuItem("About"); item1.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("About"); }/*w ww. j a v a 2s . c o m*/ }); MenuItem item2 = new MenuItem("Preferences"); item2.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { System.out.println("Preferences"); } }); final ContextMenu contextMenu = new ContextMenu(item1, item2); contextMenu.setOnShowing(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("showing"); } }); contextMenu.setOnShown(new EventHandler<WindowEvent>() { public void handle(WindowEvent e) { System.out.println("shown"); } }); notification.setContextMenu(contextMenu); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }