Guest User

Untitled

a guest
Aug 10th, 2018
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. // Author : Jason Purcell
  2. // Student Number : J00379276
  3. // Date Submitted : Mar 21, 2013
  4. // file : Login.java
  5. // Class :
  6. // Identification : Login.java
  7. // Purpose :
  8. import javax.swing.*;
  9. import java.awt.event.*;
  10. import java.awt.*;
  11.  
  12. public class Login extends JFrame
  13. {
  14. // class variables
  15. JButton Jbt;
  16. JButton Jbt2;
  17. JButton Jbt3;
  18. JLabel sSays;
  19. JLabel entr;
  20. JLabel Hscr;
  21. JTextField Jtx;
  22.  
  23. public Login()
  24. {
  25.  
  26. // set size of layout
  27. setLayout(new BorderLayout());
  28.  
  29. // labels and buttons
  30. sSays = new JLabel("Simon Says");
  31. sSays.setFont(new Font("SansSerif",Font.PLAIN, 30));
  32. entr = new JLabel("Please Enter Username to begin:");
  33. Jtx = new JTextField(15);
  34. Jbt = new JButton("Login");
  35. Jbt2 = new JButton("Create New User");
  36. Hscr = new JLabel("High Scores");
  37.  
  38. // set panels
  39. JPanel labl = new JPanel(new FlowLayout());
  40.  
  41. JPanel sel = new JPanel(new FlowLayout(FlowLayout.CENTER, 100, 50));
  42.  
  43. // set panel colors
  44. labl.setBackground(Color.WHITE);
  45. sel.setBackground(Color.lightGray);
  46.  
  47.  
  48. // add lable to labl panel
  49. labl.add(sSays);
  50.  
  51.  
  52. // add to sel Panel
  53. sel.add(entr);
  54. sel.add(Jtx);
  55. sel.add(Jbt);
  56. Jbt.setBackground(Color.orange);
  57. sel.add(Jbt2);
  58. Jbt2.setBackground(Color.orange);
  59. sel.add(Hscr);
  60.  
  61.  
  62. // add panels to frame
  63. add(labl,BorderLayout.NORTH);
  64.  
  65. add(sel,BorderLayout.CENTER);
  66.  
  67.  
  68. // set size
  69. setSize(400,500);
  70. // set frame default on close
  71. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  72. // set frame to visible
  73. setVisible(true);
  74.  
  75. }// end constructor
  76.  
  77. public static void main(String[] args)
  78. {
  79. new Login();
  80. }// end of main
  81.  
  82. }// end of class
Add Comment
Please, Sign In to add comment