Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. import java.awt.EventQueue;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JLabel;
  5. import javax.swing.JTextField;
  6. import javax.swing.JPasswordField;
  7. import javax.swing.JMenuBar;
  8. import javax.swing.JButton;
  9. import java.awt.event.ActionListener;
  10. import java.awt.event.ActionEvent;
  11. import java.awt.CardLayout;
  12. import java.awt.Color;
  13. import java.awt.Font;
  14. import java.awt.SystemColor;
  15. import org.eclipse.wb.swing.FocusTraversalOnArray;
  16. import java.awt.Component;
  17. import javax.swing.JPanel;
  18. import javax.swing.border.BevelBorder;
  19. import javax.swing.DropMode;
  20.  
  21.  
  22. public class Database {
  23.  
  24. private JFrame frame;
  25. private JFrame frame1;
  26. private JTextField textField;
  27. private JPasswordField passwordField;
  28. private JTextField textField_1;
  29. private JPanel panel;
  30.  
  31. /**
  32. * Launch the application.
  33. */
  34. public static void main(String[] args) {
  35. EventQueue.invokeLater(new Runnable() {
  36. public void run() {
  37. try {
  38. Database window = new Database();
  39. window.frame.setVisible(true);
  40. } catch (Exception e) {
  41. e.printStackTrace();
  42. }
  43. }
  44. });
  45. }
  46.  
  47. /**
  48. * Create the application.
  49. */
  50. public Database() {
  51. initialize();
  52. }
  53.  
  54. /**
  55. * Initialize the contents of the frame.
  56. */
  57. private void initialize() {
  58. frame = new JFrame();
  59. frame.getContentPane().setForeground(SystemColor.activeCaption);
  60. frame.getContentPane().setBackground(Color.LIGHT_GRAY);
  61. frame.getContentPane().setFont(new Font("Tahoma", Font.BOLD, 13));
  62. frame.setBounds(100, 100, 450, 476);
  63. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  64. frame.getContentPane().setLayout(null);
  65. /*frame1=new JFrame();
  66. frame1.getContentPane().setForeground(SystemColor.activeCaption);
  67. frame1.getContentPane().setBackground(Color.LIGHT_GRAY);
  68. frame1.getContentPane().setFont(new Font("Tahoma", Font.BOLD, 13));
  69. frame1.setBounds(100, 100, 450, 476);
  70. frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  71. frame1.getContentPane().setLayout(null);*/
  72. panel = new JPanel();
  73. panel.setBounds(0, 0, 544, 430);
  74. frame.getContentPane().add(panel);
  75. panel.setLayout(null);
  76.  
  77. JPanel panel_1 = new JPanel();
  78. panel_1.setBounds(0, 0, 544, 430);
  79. panel.add(panel_1, "first");
  80. panel_1.setLayout(null);
  81.  
  82. textField = new JTextField();
  83. textField.setBounds(154, 163, 126, 20);
  84. panel_1.add(textField);
  85. textField.setColumns(10);
  86.  
  87. JLabel lblUsername = new JLabel("Username");
  88. lblUsername.setBounds(64, 166, 75, 14);
  89. lblUsername.setFont(new Font("Tahoma", Font.BOLD, 13));
  90. lblUsername.setBackground(Color.BLUE);
  91. panel_1.add(lblUsername);
  92.  
  93. JLabel lblPassword = new JLabel("Password");
  94. lblPassword.setBounds(64, 197, 69, 14);
  95. lblPassword.setFont(new Font("Tahoma", Font.BOLD, 13));
  96. panel_1.add(lblPassword);
  97.  
  98. passwordField = new JPasswordField();
  99. passwordField.setBounds(154, 194, 126, 20);
  100. panel_1.add(passwordField);
  101.  
  102. JButton btnLogin = new JButton("login");
  103. btnLogin.setBounds(154, 249, 89, 23);
  104.  
  105. btnLogin.setBackground(Color.ORANGE);
  106. panel_1.add(btnLogin);
  107.  
  108. final JPanel panel_2 = new JPanel();
  109. panel_2.setBounds(318, 58, 89, 23);
  110. panel_1.add(panel_2,"second");
  111. panel_2.setLayout(null);
  112.  
  113. JButton btnSignUp = new JButton("sign up");
  114. btnSignUp.addActionListener(new ActionListener() {
  115. public void actionPerformed(ActionEvent e) {
  116.  
  117. // frame1.setVisible(true);
  118. // frame.setVisible(false);
  119.  
  120.  
  121. }
  122. });
  123. btnSignUp.setBounds(0, 0, 89, 23);
  124. panel_2.add(btnSignUp);
  125. btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 13));
  126. btnSignUp.setBackground(Color.WHITE);
  127.  
  128. JPanel panel_3 = new JPanel();
  129. panel_3.setBorder(new BevelBorder(BevelBorder.LOWERED, new Color(255, 0, 0), Color.RED, Color.RED, Color.RED));
  130. panel_3.setBounds(36, 107, 331, 215);
  131. panel_1.add(panel_3,"third");
  132. panel_3.setLayout(null);
  133.  
  134. textField_1 = new JTextField();
  135. textField_1.setBounds(50, 184, 236, 20);
  136. textField_1.setEnabled(true);
  137. textField_1.setEditable(true);
  138. panel_3.add(textField_1);
  139. textField_1.setColumns(10);
  140.  
  141. JLabel lblNewLabel = new JLabel("login");
  142. lblNewLabel.setBounds(149, 24, 46, 14);
  143. panel_3.add(lblNewLabel);
  144. panel.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{textField, lblUsername, lblPassword, passwordField, btnLogin, btnSignUp}));
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement