Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package project;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JPasswordField;
- import javax.swing.JTextField;
- /**
- *
- * @author lenovo
- */
- public class LoginFrame {
- LoginFrame(){
- JFrame jf = new JFrame();
- JPanel jp = new JPanel();
- JLabel userLabel = new JLabel("Username:");
- JTextField userTextField = new JTextField(13);
- JLabel passLabel = new JLabel("Password:");
- JPasswordField passTextField = new JPasswordField(13);
- JButton loginButton = new JButton("Login");
- JLabel account = new JLabel();
- account.setText("Create a new account");
- JLabel signUp = new JLabel("<HTML> <U>SignUp</U> <HTML>");
- jp.add(userLabel);
- jp.add(userTextField);
- jp.add(passLabel);
- jp.add(passTextField);
- jp.add(loginButton);
- jp.add(account);
- jp.add(signUp);
- jp.setLayout(null);
- jp.setBackground(Color.orange);
- Font font = new Font("Courier", Font.BOLD,14);
- userLabel.setBounds(100,50,120,130);
- userLabel.setFont(font);
- userTextField.setBounds(180,105,150,22);
- passLabel.setBounds(100,105,120,130);
- passLabel.setFont(font);
- passTextField.setBounds(180,160,150,22);
- loginButton.setBounds(160, 230, 90, 30);
- account.setBounds(145,245,140,60);
- signUp.setBounds(185, 272, 100, 50);
- jf.add(jp);
- jf.setTitle("Login");
- jf.setSize(400,400);
- jf.setVisible(true);
- jf.setLocationRelativeTo(null);
- jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- signUp.addMouseListener(new MouseAdapter(){
- public void mouseClicked(MouseEvent e){
- new RegisterFrame();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement