Advertisement
Guest User

Untitled

a guest
Oct 31st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. /**
  2. * https://www.youtube.com/watch?v=MNV2FyA96XM&list=PL53A7C2BE1F8D780C&index=32
  3. * @author Sahaj Khan
  4. */
  5.  
  6.  
  7. import javax.swing.*;
  8. import java.awt.*;
  9. import java.awt.event.ActionListener;
  10.  
  11.  
  12. public class Psych extends JFrame implements ActionListener{
  13.  
  14. JFrame jf = new JFrame();
  15. JPanel panelName = new JPanel();
  16. JLabel labelName;
  17.  
  18.  
  19. public Psych() {
  20.  
  21. setTitle("FoilMaker");
  22. setSize(400,400);
  23. setVisible(true);
  24. setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  25. //setResizable(false);
  26.  
  27.  
  28.  
  29. labelName = new JLabel("FoilMaker");
  30. panelName.add(labelName);
  31. add(panelName, BorderLayout.NORTH);
  32.  
  33.  
  34. JPanel userNamePassword = new JPanel();
  35. JTextField inputUserName = new JTextField(10);
  36. JPasswordField inputPassword = new JPasswordField(10); //I changed it from JPasswordField to inputPassword
  37. //inputPassword.setActionCommand(OK);
  38. //inputPassword.addActionListener(this);
  39.  
  40. userNamePassword.add(new JLabel("Username"));
  41. userNamePassword.add(inputUserName);
  42. userNamePassword.add(new JLabel("Password"));
  43. userNamePassword.add(inputPassword);
  44. add(userNamePassword, BorderLayout.CENTER);
  45.  
  46.  
  47. JPanel loginRegisterButtons = new JPanel();
  48. loginRegisterButtons.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 200)); // The numbers in the FlowLayout control the (X, gap between buttons, and Y)
  49. loginRegisterButtons.add(new JButton("Login"));
  50. loginRegisterButtons.add(new JButton("Register"));
  51. add(loginRegisterButtons, BorderLayout.SOUTH);
  52.  
  53.  
  54.  
  55. }
  56.  
  57. public void drawRectangle(Graphics g) {
  58. g.setColor(Color.ORANGE);
  59. g.fillRect(240,240, 400, 500);
  60.  
  61. }
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. public static void main(String[] args) {
  80. Psych p = new Psych();
  81. //p.drawRectangle(null);
  82.  
  83.  
  84. //JOptionPane.showInputDialog(null, "Some sort of question here", "Also perhaps title");
  85.  
  86.  
  87. // int temp = JOptionPane.showOptionDialog(null, "Do you have valid residency status?", "Residency Status",
  88. // JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
  89.  
  90.  
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement