Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JTextField;
- import javax.swing.JLabel;
- import javax.swing.JButton;
- import javax.swing.JPanel;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class LoginWindow {
- private JFrame frame;
- private JTextField usrField;
- private JTextField pswField;
- private JPanel panel;
- private JLabel L1;
- private JButton sub1;
- private JPanel lgP(){
- JPanel JP1 = new JPanel();
- L1 = new JLabel ("Enter something!!!");
- sub1 = new JButton("Submit");
- JP1.add(L1);
- JP1.add(sub1);
- return JP1;
- }
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- LoginWindow window = new LoginWindow();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public LoginWindow() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- panel = lgP();
- frame.add(panel);
- frame.setBounds(100, 100, 450, 300);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- usrField = new JTextField();
- usrField.setBounds(141, 67, 130, 26);
- frame.getContentPane().add(usrField);
- usrField.setColumns(10);
- pswField = new JTextField();
- pswField.setBounds(141, 126, 130, 26);
- frame.getContentPane().add(pswField);
- pswField.setColumns(10);
- JLabel lblUsername = new JLabel("Username");
- lblUsername.setBounds(170, 47, 77, 16);
- frame.getContentPane().add(lblUsername);
- JLabel lblPassword = new JLabel("Password");
- lblPassword.setBounds(170, 105, 72, 16);
- frame.getContentPane().add(lblPassword);
- JButton btnLogin = new JButton("LogIn");
- btnLogin.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- }
- });
- btnLogin.setBounds(57, 207, 117, 29);
- frame.getContentPane().add(btnLogin);
- JButton btnRegister = new JButton("Register");
- btnRegister.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- //verifica ed entra
- }
- });
- btnRegister.setBounds(222, 207, 117, 29);
- frame.getContentPane().add(btnRegister);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement