Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.event.*;
- public class LogInForm implements ActionListener{
- private JFrame jfLogIn;
- private JLabel jlUser, jlPass;
- private JTextField jtfUser;
- private JPasswordField jpPass;
- private JButton jbOk, jbCancel;
- public LogInForm(){
- jfLogIn = new JFrame("Log In");
- jlUser = new JLabel("Username: ");
- jlPass = new JLabel("Password: ");
- jtfUser = new JTextField();
- jpPass = new JPasswordField();
- jbOk = new JButton("Ok");
- jbCancel = new JButton("Cancel");
- }
- public void launch(){
- jfLogIn.setLayout(null);
- jfLogIn.setBounds(160, 150, 400, 300);
- jfLogIn.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- jlUser.setBounds(30, 50, 150, 30);
- jfLogIn.add(jlUser);
- jlPass.setBounds(30, 100, 100, 30);
- jfLogIn.add(jlPass);
- jtfUser.setBounds(150, 50, 200, 30);
- jfLogIn.add(jtfUser);
- jpPass.setBounds(150, 100, 200, 30);
- jfLogIn.add(jpPass);
- jbOk.setBounds(60, 160, 100, 30);
- jbOk.addActionListener(this);
- jfLogIn.add(jbOk);
- jbCancel.setBounds(200, 160, 100, 30);
- jbCancel.addActionListener(this);
- jfLogIn.add(jbCancel);
- jfLogIn.setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement