Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.*;
- import javax.swing.*;
- public class LoginScreenGUI extends JFrame implements ActionListener {
- private String username, password;
- private int width, height;
- ImagePicture pic;
- JLabel lblUsername, lblPassword;
- JTextField txtUsername, txtPassword, txtAccountNumber;
- JButton btnLogin, btnExit, btnSignUp, btnCreate, btnReturn;
- public LoginScreenGUI() {
- super ("Bank Application");
- width = 0;
- height = 0;
- setLayout(null);
- lblUsername = new JLabel ("Enter User Name");
- lblPassword = new JLabel ("Enter Password");
- txtUsername = new JTextField (" ");
- txtPassword = new JTextField (" ");
- btnLogin = new JButton ("Login");
- btnExit = new JButton ("Exit");
- btnSignUp = new JButton ("Sign Up");
- setSize (1000, 700);
- txtUsername.setBounds(450, 300, 100, 40);
- txtPassword.setBounds(450, 350, 100, 40);
- btnLogin.setBounds(150, 500, 80, 40);
- btnExit.setBounds(750, 500, 80, 40);
- btnSignUp.setBounds(450, 500, 80, 40);
- add(lblUsername);
- add(lblPassword);
- add(txtUsername);
- add(txtPassword);
- add(btnLogin);
- add(btnExit);
- add(btnSignUp);
- btnLogin.addActionListener(this);
- btnExit.addActionListener(this);
- btnSignUp.addActionListener(this);
- setVisible(true);
- }
- public void actionPerformed (ActionEvent e) {
- if (e.getSource() == btnSignUp) {
- dispose();
- JFrame myFrame = new JFrame();
- setSize (1000, 700);
- txtUsername = new JTextField(" ");
- txtPassword = new JTextField(" ");
- btnCreate = new JButton ("Create Account");
- btnExit = new JButton ("Exit");
- btnReturn = new JButton ("Return To Login");
- add(txtUsername);
- add(txtPassword);
- add(txtAccountNumber);
- add(btnCreate);
- add(btnExit);
- add(btnReturn);
- myFrame.setVisible(true);
- /* generates new account number everytime the
- * create account button is pressed
- */
- public void actionPerformedNested (ActionEvent f) {
- if (e.getSource() == btnCreate) {
- }
- if (e.getSource() == btnExit) {
- System.exit(0);
- }
- if (e.getSource() == btnReturn) {
- dispose();
- LoginScreenGUI.setVisible(true);
- }
- }
- }
- if (e.getSource() == btnLogin) {
- new BalancesGUI();
- }
- if (e.getSource() == btnExit) {
- System.exit(0);
- }
- }
- public static void main(String[] args) {
- new LoginScreenGUI();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement