Advertisement
Guest User

CS Login Exercise

a guest
Jan 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package c12_juan_login;
  7.  
  8. import javafx.application.Application;
  9. import javafx.geometry.Insets;
  10. import javafx.geometry.Pos;
  11. import javafx.scene.Scene;
  12. import javafx.scene.control.Label;
  13. import javafx.scene.control.PasswordField;
  14. import javafx.scene.control.TextField;
  15. import javafx.scene.layout.GridPane;
  16. import javafx.scene.text.Font;
  17. import javafx.scene.text.Text;
  18. import javafx.stage.Stage;
  19.  
  20. /**
  21. *
  22. * @author charm
  23. */
  24. public class C12_JUAN_Login extends Application {
  25.  
  26. public static void main (String[] args){
  27. launch(args);
  28. }
  29.  
  30. @Override
  31. public void start(Stage primaryStage) throws Exception {
  32. Text sceneTitle = new Text("Welcome!");
  33. sceneTitle.setFont(Font.font("Century Gothic"));
  34. GridPane greed = new GridPane();
  35. greed.add(sceneTitle, 0, 0, 2, 1);
  36. greed.setAlignment(Pos.CENTER);
  37. greed.setPadding(new Insets(25, 25, 25, 25));
  38. greed.setHgap(10);
  39. greed.setVgap(10);
  40.  
  41. Label userName = new Label("User Name:");
  42. greed.add(userName, 0, 1);
  43. TextField userTextField = new TextField();
  44. greed.add(userTextField, 1, 1);
  45.  
  46. Label password = new Label("Password:");
  47. greed.add(password, 0, 2);
  48. PasswordField passwordField = new PasswordField();
  49. greed.add(passwordField, 1, 2);
  50.  
  51. Scene scenery = new Scene(greed, 300, 275);
  52. primaryStage.setScene(scenery);
  53. primaryStage.show();
  54.  
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement