Skip to content

Commit c621e28

Browse files
committed
Added the UI to choose between login and registering
1 parent 278a037 commit c621e28

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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

Comments
 (0)