Guest User

Untitled

a guest
Jul 13th, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. package com.manoj.hello.javaFx.form;
  2.  
  3. import javafx.application.Application;
  4. import javafx.geometry.Insets;
  5. import javafx.scene.Scene;
  6. import javafx.scene.control.Button;
  7. import javafx.scene.control.Label;
  8. import javafx.scene.control.TextField;
  9. import javafx.scene.layout.GridPane;
  10. import javafx.scene.layout.HBox;
  11. import javafx.stage.Stage;
  12.  
  13. /**
  14. * Created by MANOJ on 13-Jul-17.
  15. */
  16. public class FormMainEx extends Application {
  17. public static void main(String[] args) {
  18. launch(args);
  19. }
  20. @Override
  21. public void start (Stage firstStage){
  22. firstStage.setTitle("Application Form");
  23.  
  24. GridPane gridPane = new GridPane();
  25. gridPane.setPadding(new Insets(10,10,10,10));
  26. gridPane.setHgap(10);
  27. gridPane.setVgap(10);
  28.  
  29. HBox hbox = new HBox(10);//10 px spacing between child nodes
  30.  
  31.  
  32. Label name = new Label("UserName");
  33. GridPane.setConstraints(name, 0,0);
  34.  
  35. TextField userName = new TextField();
  36. GridPane.setConstraints(userName, 1,0);
  37. userName.setPromptText("ex-2626manoj");
  38.  
  39. Label pass = new Label("Password");
  40. GridPane.setConstraints(pass, 0,1);
  41.  
  42. TextField password = new TextField();
  43. GridPane.setConstraints(password, 1,1);
  44. password.setPromptText("Ex-abc@123");
  45.  
  46. Button button = new Button("LogIn");
  47.  
  48.  
  49. Button button2 = new Button("SignUp");
  50.  
  51.  
  52. gridPane.getChildren().addAll(name,userName,pass,password);
  53. hbox.getChildren().addAll(button,button2);
  54.  
  55. Scene scene = new Scene(gridPane,400,400);
  56.  
  57.  
  58.  
  59. firstStage.setScene(scene);
  60. firstStage.show();
  61.  
  62.  
  63. }
  64. }
Add Comment
Please, Sign In to add comment