|
| 1 | +package screens.user_registration_screen; |
| 2 | + |
| 3 | +import data_access.UserDatabase; |
| 4 | +import screens.login_screen.UserLoginUI; |
| 5 | +import screens.user_registration_screen.UserRegistrationUI; |
| 6 | + |
| 7 | +import javax.swing.*; |
| 8 | +import java.awt.event.ActionEvent; |
| 9 | +import java.awt.event.ActionListener; |
| 10 | + |
| 11 | +public class LoginRegisterScreen implements ActionListener { |
| 12 | + |
| 13 | + JButton login = new JButton("login"); |
| 14 | + JButton register = new JButton("register"); |
| 15 | + |
| 16 | + public LoginRegisterScreen(){ |
| 17 | + JFrame loginRegFrame = new JFrame(); |
| 18 | + loginRegFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
| 19 | + loginRegFrame.setSize(400, 200); |
| 20 | + JPanel loginRegPanel = new JPanel(); |
| 21 | + loginRegFrame.add(loginRegPanel); |
| 22 | + JLabel message = new JLabel("Do you want to Login or Register?"); |
| 23 | + message.setBounds(10, 30, 200, 25); |
| 24 | + loginRegPanel.add(message); |
| 25 | + login.setBounds(10, 60, 70, 30); |
| 26 | + register.setBounds(110, 60, 70, 30); |
| 27 | + } |
| 28 | + |
| 29 | + @Override |
| 30 | + public void actionPerformed(ActionEvent e) { |
| 31 | + if(e.getSource().equals(login)){ |
| 32 | + UserLoginUI loginUI = new UserLoginUI(new UserDatabase()); |
| 33 | + loginUI.getLoginCredentials(); |
| 34 | + }else{ |
| 35 | + UserRegistrationUI registrationUI = new UserRegistrationUI(new UserDatabase()); |
| 36 | + registrationUI.GetUserCredentials(); |
| 37 | + } |
| 38 | + } |
| 39 | +} |
0 commit comments