Guest User

Untitled

a guest
Nov 27th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. package raizel;
  2.  
  3. import javax.swing.*;
  4.  
  5. import java.awt.*;
  6.  
  7. public class LogIn
  8. {
  9. private JButton login,signup,register,back,delete,update,logout,delbutton,upbutton;
  10. private final JFrame frame;
  11. private JTextField typelog,typesign,typesign1,typesign2,delsign,upsign,uppass,delpass;
  12. private JLabel user,pass,name,user1,pass1,deluser,upuser,deluserpass,upuserpass;
  13. private JPasswordField typepass;
  14. private JPanel logpanel,signpanel,mypanel,delpanel,uppanel;
  15. private String names [] = {"LogIn","SignUp","Register","Back","Username","Password","Name","Delete","Update","LogOut"};
  16. private LogInEvents e;
  17.  
  18.  
  19. public LogIn()
  20. {
  21. this.frame = new JFrame("LogInGui");
  22. //buttons
  23. this.login = new JButton(this.names[0]);
  24. this.signup = new JButton(this.names[1]);
  25. this.register = new JButton(this.names[2]);
  26. this.back = new JButton(this.names[3]);
  27. this.delete = new JButton(this.names[7]);
  28. this.update = new JButton(this.names[8]);
  29. this.logout = new JButton(this.names[9]);
  30. this.delbutton = new JButton(this.names[7]);
  31. this.upbutton = new JButton(this.names[8]);
  32. //textfields
  33. this.typelog = new JTextField(10);
  34. this.typesign = new JTextField(10);
  35. this.typesign1 = new JTextField(10);
  36. this.typesign2 = new JTextField(10);
  37. this.delsign = new JTextField(10);
  38. this.upsign = new JTextField(10);
  39. this.uppass = new JTextField(10);
  40. this.delpass = new JTextField(10);
  41. //panel 1 labels
  42. this.user = new JLabel(this.names[4]);
  43. this.pass = new JLabel(this.names[5]);
  44. this.name = new JLabel(this.names[6]);
  45. //panel 2 labels
  46. this.user1 = new JLabel(this.names[4]);
  47. this.pass1 = new JLabel(this.names[5]);
  48. //panel del labels
  49. this.deluser = new JLabel(this.names[4]);
  50. this.deluserpass = new JLabel(this.names[5]);
  51. //panel update labels
  52. this.upuser = new JLabel(this.names[4]);
  53. this.upuserpass = new JLabel(this.names[5]);
  54.  
  55. //passfield
  56. this.typepass = new JPasswordField();
  57. //panel LOG IN PANEL 1
  58. this.logpanel = new JPanel();
  59. //panel SignUpPanel 2
  60. this.signpanel = new JPanel();
  61. //panel My Panel 3
  62. this.mypanel = new JPanel();
  63. //panel Del Panel 4
  64. this.delpanel = new JPanel();
  65. //panel Update Panel 5
  66. this.uppanel = new JPanel();
  67.  
  68. //events
  69. this.e = new LogInEvents(this);
  70. //actionlisteners
  71. this.back.addActionListener(this.e);
  72. this.login.addActionListener(this.e);
  73. this.register.addActionListener(this.e);
  74. this.signup.addActionListener(this.e);
  75. this.delete.addActionListener(this.e);
  76. this.update.addActionListener(this.e);
  77. this.logout.addActionListener(this.e);
  78. this.delbutton.addActionListener(this.e);
  79. this.upbutton.addActionListener(this.e);
  80. }
  81.  
  82.  
  83. public void LogInPanel(boolean gwapo)
  84. {
  85. this.logpanel.setSize(20,20);
  86. this.logpanel.setLayout(new GridLayout(3,2));
  87. this.logpanel.add(this.user);
  88. this.logpanel.add(this.typelog);
  89. this.logpanel.add(this.pass);
  90. this.logpanel.add(this.typepass);
  91. this.logpanel.add(this.login);
  92. this.logpanel.add(this.signup);
  93. this.logpanel.setVisible(gwapo);
  94. this.typelog.requestFocus();
  95. //frame
  96. this.frame.setVisible(true);
  97. this.frame.add(this.logpanel);
  98. //this.frame.setTitle("LogInPanel");
  99. this.frame.setResizable(false);
  100. this.frame.pack();
  101. this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  102.  
  103. }
  104.  
  105. public void SignUpPanel(boolean cute)
  106. {
  107. this.signpanel.setLayout(new GridLayout(4,3));
  108. this.signpanel.add(this.name);
  109. this.signpanel.add(this.typesign);
  110. this.signpanel.add(this.user1);
  111. this.signpanel.add(this.typesign1);
  112. this.signpanel.add(this.pass1);
  113. this.signpanel.add(this.typesign2);
  114. this.signpanel.add(this.register);
  115. this.signpanel.add(this.back);
  116. this.signpanel.setVisible(cute);
  117. this.typesign.requestFocus();
  118. this.frame.setTitle("SignUp");
  119. this.frame.add(this.signpanel);
  120. }
  121. public void MyPanel(boolean cool)
  122. {
  123. this.mypanel.setLayout(new GridLayout(1,3));
  124. this.mypanel.add(this.delete);
  125. this.mypanel.add(this.update);
  126. this.mypanel.add(this.logout);
  127. this.mypanel.setVisible(cool);
  128. this.frame.add(this.mypanel);
  129. this.frame.setTitle("MyPanel");
  130. }
  131.  
  132. public void DelPanel(boolean rai)
  133. {
  134. this.delpanel.setLayout(new GridLayout(3,2));
  135. this.delpanel.add(this.deluser);
  136. this.delpanel.add(this.delsign);
  137. this.delpanel.add(this.deluserpass);
  138. this.delpanel.add(this.delpass);
  139. this.delpanel.add(this.delbutton);
  140.  
  141. this.frame.add(this.delpanel);
  142. this.frame.setTitle("DeletePanel");
  143. }
  144.  
  145. public void UpdatePanel(boolean zel)
  146. {
  147. this.uppanel.setLayout(new GridLayout());
  148. this.uppanel.add(this.upuser);
  149. this.uppanel.add(this.upsign);
  150. this.uppanel.add(this.upuserpass);
  151. this.uppanel.add(this.uppass);
  152. this.uppanel.add(this.upbutton);
  153. this.uppanel.setVisible(zel);
  154. this.frame.add(this.uppanel);
  155. this.frame.setTitle("UpdatePanel");
  156. }
  157.  
  158.  
  159. public void showLogPanel(boolean x)
  160. {
  161. this.logpanel.setVisible(x);
  162. }
  163. public void showDelPanel(boolean y)
  164. {
  165. this.delpanel.setVisible(y);
  166. }
  167. //button getters
  168. public JButton getButtonLogIn()
  169. {
  170. return this.login;
  171. }
  172. public JButton getButtonSignUp()
  173. {
  174. return this.signup;
  175. }
  176. public JButton getButtonRegister()
  177. {
  178. return this.register;
  179. }
  180. public JButton getButtonBack()
  181. {
  182. return this.back;
  183. }
  184. public JButton getButtonDelete()
  185. {
  186. return this.delete;
  187. }
  188. public JButton getbButtonUpdate()
  189. {
  190. return this.update;
  191. }
  192. public JButton getButtonLogOut()
  193. {
  194. return this.logout;
  195. }
  196. public JButton getButtonDelPanel()
  197. {
  198. return this.delbutton;
  199. }
  200. public JButton getButtonUpdatePanel()
  201. {
  202. return this.upbutton;
  203. }
  204. //field getters
  205. public JTextField getFieldUserName()
  206. {
  207. return this.typelog;
  208. }
  209. public JPasswordField getFieldPassword()
  210. {
  211. return this.typepass;
  212. }
  213. public JTextField getFieldSignName()
  214. {
  215. return this.typesign;
  216. }
  217. public JTextField getFieldSignUserName()
  218. {
  219. return this.typesign1;
  220. }
  221. public JTextField getFieldSignPassword()
  222. {
  223. return this.typesign2;
  224. }
  225. public JTextField getFieldDelUsername()
  226. {
  227. return this.delsign;
  228. }
  229. public JTextField getfFieldDelPassword()
  230. {
  231. return this.delpass;
  232. }
  233.  
  234. }
Add Comment
Please, Sign In to add comment