SHARE
TWEET

guijava

a guest Aug 12th, 2016 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.EventQueue;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JTextField;
  5. import javax.swing.JLabel;
  6. import javax.swing.JButton;
  7. import javax.swing.JPanel;
  8. import java.awt.event.ActionListener;
  9. import java.awt.event.ActionEvent;
  10.  
  11. public class LoginWindow {
  12.  
  13.     private JFrame frame;
  14.     private JTextField usrField;
  15.     private JTextField pswField;
  16.     private JPanel panel;
  17.     private JLabel L1;
  18.     private JButton sub1;
  19.    
  20.     private JPanel lgP(){
  21.        
  22.         JPanel JP1 = new JPanel();
  23.  
  24.         L1 = new JLabel ("Enter something!!!");
  25.         sub1 = new JButton("Submit");
  26.         JP1.add(L1);
  27.         JP1.add(sub1);
  28.         return JP1;
  29.        
  30.     }
  31.    
  32.     /**
  33.      * Launch the application.
  34.      */
  35.     public static void main(String[] args) {
  36.         EventQueue.invokeLater(new Runnable() {
  37.             public void run() {
  38.                 try {
  39.                     LoginWindow window = new LoginWindow();
  40.                     window.frame.setVisible(true);
  41.                 } catch (Exception e) {
  42.                     e.printStackTrace();
  43.                 }
  44.             }
  45.         });
  46.     }
  47.  
  48.     /**
  49.      * Create the application.
  50.      */
  51.     public LoginWindow() {
  52.         initialize();
  53.     }
  54.  
  55.     /**
  56.      * Initialize the contents of the frame.
  57.      */
  58.     private void initialize() {
  59.         frame = new JFrame();
  60.         panel = lgP();
  61.         frame.add(panel);
  62.        
  63.         frame.setBounds(100, 100, 450, 300);
  64.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  65.         frame.getContentPane().setLayout(null);
  66.        
  67.        
  68.        
  69.        
  70.         usrField = new JTextField();
  71.         usrField.setBounds(141, 67, 130, 26);
  72.         frame.getContentPane().add(usrField);
  73.         usrField.setColumns(10);
  74.        
  75.         pswField = new JTextField();
  76.         pswField.setBounds(141, 126, 130, 26);
  77.         frame.getContentPane().add(pswField);
  78.         pswField.setColumns(10);
  79.        
  80.         JLabel lblUsername = new JLabel("Username");
  81.         lblUsername.setBounds(170, 47, 77, 16);
  82.         frame.getContentPane().add(lblUsername);
  83.        
  84.         JLabel lblPassword = new JLabel("Password");
  85.         lblPassword.setBounds(170, 105, 72, 16);
  86.         frame.getContentPane().add(lblPassword);
  87.        
  88.         JButton btnLogin = new JButton("LogIn");
  89.         btnLogin.addActionListener(new ActionListener() {
  90.             public void actionPerformed(ActionEvent e) {
  91.                
  92.             }
  93.         });
  94.         btnLogin.setBounds(57, 207, 117, 29);
  95.         frame.getContentPane().add(btnLogin);
  96.        
  97.         JButton btnRegister = new JButton("Register");
  98.         btnRegister.addActionListener(new ActionListener() {
  99.             public void actionPerformed(ActionEvent e) {
  100.                 //verifica ed entra
  101.             }
  102.         });
  103.         btnRegister.setBounds(222, 207, 117, 29);
  104.         frame.getContentPane().add(btnRegister);
  105.     }
  106. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top