Advertisement
SavageKiller13

JavaFX

Apr 9th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. public class Login extends Application {
  2. public static void Main(String args[]) {
  3. launch(args);
  4. }
  5.  
  6. @Override
  7. public void start(Stage primaryStage) {
  8. primaryStage.setTitle("JavaFX Welcome");
  9.  
  10. GridPane grid = new GridPane();
  11. grid.setAlignment(Pos.CENTER);
  12. grid.setHgap(10);
  13. grid.setVgap(10);
  14. grid.setPadding(new Insets(25, 25, 25, 25));
  15.  
  16. Text sceneTitle = new Text("Welcome");
  17. sceneTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
  18. grid.add(grid, 0, 0, 2, 1);
  19.  
  20. Label userName = new Label("User Name:");
  21. grid.add(userName, 0, 1);
  22.  
  23. TextField userTextField = new TextField();
  24. grid.add(userTextField, 1, 1);
  25.  
  26. Label pw = new Label("Password:");
  27. grid.add(pw, 0, 2);
  28.  
  29. PasswordField pwBox = new PasswordField();
  30. grid.add(pwBox, 1, 2);
  31.  
  32. Button btn = new Button("Sign In");
  33. HBox hbBtn = new HBox(10);
  34. hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
  35. hbBtn.getChildren().add(btn);
  36. grid.add(hbBtn, 1, 4);
  37.  
  38. final Text actionTarget = new Text();
  39. grid.add(actionTarget, 1, 6);
  40.  
  41. Scene scene = new Scene(grid, 300, 275);
  42. primaryStage.show();
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement