List of usage examples for javafx.scene.layout GridPane setPadding
public final void setPadding(Insets value)
From source file:jlotoprint.MainViewController.java
public static void showExceptionAlert(String message, String details) { Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.OK); alert.initModality(Modality.APPLICATION_MODAL); alert.initOwner(JLotoPrint.stage.getScene().getWindow()); TextArea textArea = new TextArea(details); textArea.setEditable(false);/* ww w . j a v a 2s .co m*/ textArea.setWrapText(true); GridPane grid = new GridPane(); grid.setPadding(new Insets(10, 10, 0, 10)); grid.add(textArea, 0, 0); //set content alert.getDialogPane().setExpandableContent(grid); alert.showAndWait(); }
From source file:jlotoprint.MainViewController.java
public static void loadAboutWindow() { //setup/*from w w w. j a v a2 s . c o m*/ Dialog dialog = new Dialog<>(); dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE); dialog.setTitle("About JLotoPanel"); dialog.setHeaderText("JLotoPanel v1.0"); ImageView icon = new ImageView("file:resources/icon.png"); icon.setSmooth(true); icon.setFitHeight(48.0); icon.setFitWidth(48.0); dialog.setGraphic(icon); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(JLotoPrint.stage.getScene().getWindow()); //content GridPane grid = new GridPane(); grid.setPadding(new Insets(10, 10, 0, 10)); //text TextArea textArea = new TextArea("For more info, please visit: https://github.com/mbppower/JLotoPanel"); textArea.setWrapText(true); grid.add(textArea, 0, 0); dialog.getDialogPane().setContent(grid); dialog.showAndWait(); }
From source file:Testing.TestMain.java
public static void grid(Stage stage) { GridPane grid = new GridPane(); grid.setHgap(8);/* ww w . j av a2 s .co m*/ grid.setVgap(8); grid.setPadding(new Insets(5)); Text mp3FileNameT, trackNoT, titleT, artistsT, lengthT, albumT, yearT, genreT, commentsT; mp3FileNameT = new Text("Filename:"); trackNoT = new Text("Track Number:"); titleT = new Text("Title:"); artistsT = new Text("Artists:"); lengthT = new Text("Track Length:"); albumT = new Text("Album:"); yearT = new Text("Year:"); genreT = new Text("Genere:"); commentsT = new Text("Comments/Lyrics: "); TextField mp3FileNameTF, trackNoTF, titleTF, artistsTF, lengthTF, albumTF, yearTF, genreTF; TextArea commentsTF; mp3FileNameTF = new TextField(""); trackNoTF = new TextField(""); titleTF = new TextField(""); artistsTF = new TextField(""); lengthTF = new TextField(""); albumTF = new TextField(""); yearTF = new TextField(""); genreTF = new TextField(""); commentsTF = new TextArea(""); grid.addColumn(0, mp3FileNameT, trackNoT, titleT, artistsT, lengthT, albumT, yearT, genreT, commentsT); grid.addColumn(1, mp3FileNameTF, trackNoTF, titleTF, artistsTF, lengthTF, albumTF, yearTF, genreTF, commentsTF); grid.setAlignment(Pos.TOP_LEFT); Scene scene = new Scene(grid, 500, 500); stage.setTitle("Grid Test"); stage.setScene(scene); stage.show(); }
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);//w ww . j a va2 s . com gridpane.setVgap(10); 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);//from w w w . j av a 2 s .com gridpane.setVgap(10); 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 stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 150); stage.setScene(scene);/*from w w w . j a va2s . c o m*/ stage.setTitle("Text Field Sample"); GridPane grid = new GridPane(); grid.setPadding(new Insets(10, 10, 10, 10)); grid.setVgap(5); grid.setHgap(5); scene.setRoot(grid); final TextField name = new TextField(); name.setPromptText("Enter your first name."); name.setPrefColumnCount(10); name.getText(); GridPane.setConstraints(name, 0, 0); grid.getChildren().add(name); stage.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);/* w w w .j a v a 2s . c o m*/ gridpane.setVgap(10); 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);//from w w w .ja va 2 s . com gridpane.setVgap(10); 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 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);//from ww w.j a v a 2s . c o m gridpane.setVgap(10); 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);//from w ww . ja v a2s . c om gridpane.setVgap(10); 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(); }