-
Notifications
You must be signed in to change notification settings - Fork 2
/
Welcome.java
122 lines (104 loc) · 3.8 KB
/
Welcome.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import java.awt.*;
import java.io.IOException;
import java.util.*;
import support.Client;
import user.*;
import javax.swing.*;
public class Welcome
{
Scanner sc = new Scanner(System.in);
public void showHomePage() {
System.out.print('\n');
JFrame wel = new JFrame("WELCOME");
JDialog jd = new JDialog(wel,"WELCOME",true);
wel.setFocusableWindowState(false);
wel.setVisible(true);
wel.setSize(1920,100);
JLabel label = new JLabel("* * * * Welcome to the Shopping Center * * * *",JLabel.CENTER);
label.setFont(new Font("Serif",Font.BOLD,22));
jd.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
wel.getContentPane().setBackground(Color.black);
label.setForeground(Color.YELLOW);
wel.add(label);
wel.setVisible(true);
System.out.print("1. LOGIN\n");
System.out.print("2. SIGN UP\n");
System.out.print("3. ADMIN LOGIN\n");
System.out.print("4. EXIT\n");
System.out.print("5. Support\n");
System.out.print("Enter your choice as the number indicated before the choices:\n");
int ch;
ch = sc.nextInt();
if(ch==1)
{
Customer old_customer = new Customer();
System.out.print("ENTER USERNAME : ");
old_customer.inputUsername();
System.out.print("ENTER PASSWORD : ");
old_customer.inputPassword();
try {
if(old_customer.login()==0)
{
showHomePage();
}
} catch (IOException e) {
e.printStackTrace();
}
}
else if(ch==2)
{
Customer new_user = new Customer();
System.out.print("ENTER USERNAME : ");
new_user.inputUsername();
System.out.print("ENTER PASSWORD : ");
new_user.inputPassword();
try {
if(new_user.signup()==0)
{
showHomePage();
}
} catch (IOException e) {
e.printStackTrace();
}
}
else if(ch==3)
{
Admin an_admin = new Admin();
System.out.print("ENTER USERNAME : ");
an_admin.inputUsername();
System.out.print("ENTER PASSWORD : ");
an_admin.inputPassword();
if(an_admin.login()==0)
{
showHomePage();
}
else
{
try {
an_admin.privileges();
} catch (IOException e) {
e.printStackTrace();
}
}
}
else if(ch==4)
{
System.out.print("You have been exited out of the shopping menu\nHave a nice day :)\nVisit again...\n");
System.exit(1);
}
else if(ch==5)
{
try {
Client.clientMain();
} catch (IOException e) {
e.printStackTrace();
}
}
else
{
System.out.print("Invalid input\n");
System.out.print("Please choose only from the four options as 1,2,3 or 4 ...\ntry again\n");
showHomePage();
}
}
}