Monty374

JFX 6.5

Dec 6th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package gridpane;
  2.  
  3. import javafx.scene.control.*;
  4. import javafx.application.Application;
  5. import javafx.geometry.HPos;
  6. import javafx.geometry.Insets;
  7. import javafx.geometry.Pos;
  8. import javafx.scene.Scene;
  9. import javafx.scene.layout.GridPane;
  10. import javafx.stage.Stage;
  11.  
  12. public class GridPane extends Application{
  13. @Override
  14. public void start(Stage stage1){
  15. GridPane pane = new GridPane();
  16. pane.setAlignment(Pos.CENTER);
  17. pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5)); //pads 4 edges of pane
  18. pane.setHgap(5.5);
  19. pane.setVgap(5.5);
  20. pane.add(new Label("First Name:"), 0,0); //places this in grid position row 0, column 0
  21. pane.add(new TextField(), 1,0); // in row 0, column 1
  22. pane.add(new Label("MI:"), 0,1);
  23. pane.add(new TextField(), 1,1);
  24. pane.add(new Label("Last Name:"), 0,2);
  25. pane.add(new TextField(), 1,2);
  26. pane.add(new Label("Phone Number:"), 0,3);
  27. pane.add(new TextField(), 1,3);
  28. Button btAdd = new Button("add Name");
  29. pane.add(btAdd,1,4);
  30. GridPane.setHalignment(btAdd, HPos.RIGHT);
  31.  
  32. Scene scene = new Scene(pane);
  33. stage1.setTitle("ShowGridPane");
  34. stage1.setScene(scene);
  35. stage1.show();
  36. }
  37.  
  38.  
  39. /**
  40. * @param args the command line arguments
  41. */
  42. public static void main(String[] args) {
  43. launch(args);
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment