-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomerData.java
130 lines (104 loc) · 3.4 KB
/
CustomerData.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
123
124
125
126
127
128
129
130
import java.awt.*;
import java.text.NumberFormat;
import javax.swing.*;
public class CustomerData{
PharmacyManagement pm = new PharmacyManagement();
Sales s;
JFrame frame = new JFrame();
JTextField tone = new JTextField();
JTextField ttwo = new JTextField();
JTextField tthree = new JTextField();
JTextField tfour = new JTextField();
JTextField tfive = new JTextField();
JTextField tsix = new JTextField();
public void decore(JTextField t, JLabel l, String s, JPanel p) {
t.setPreferredSize(new Dimension(150, 45));
t.setFont(new Font("Comic Sans", Font.BOLD, 17));
l.setText(s);
l.setFont(new Font("Comic Sans", Font.PLAIN, 25));
p.setBackground(Color.white);
p.setLayout(new FlowLayout(FlowLayout.CENTER, 30, 10));
p.add(l);
p.add(t);
}
CustomerData(){
JButton btn = new JButton();
btn.setText("Next");
btn.setFont(new Font("Comic Sans", Font.BOLD, 17));
btn.setBounds(640, 685, 100, 50);
btn.setFocusable(false);
btn.setBackground(new Color(0x0B2447));
btn.setForeground(Color.WHITE);
btn.addActionListener(e -> {
String email = tone.getText();
String name = ttwo.getText();
int age = Integer.parseInt(tthree.getText());
String gender = tfour.getText();
String phNo = tfive.getText();
String address = tsix.getText();
s.CustAttri(new CollectCustomerData(email, name, phNo, address, gender, age));
try {
pm.insert(email, name, address, phNo, age, gender);
} catch (Exception e1) {
}
Bill.deleteRows();
new Menu(email, 1);
frame.dispose();
});
JLabel lone = new JLabel();
JPanel pone = new JPanel();
decore(tone, lone, "Email : ", pone);
JLabel ltwo = new JLabel();
JPanel ptwo = new JPanel();
decore(ttwo, ltwo, "Name : ", ptwo);
JLabel lthree = new JLabel();
JPanel pthree = new JPanel();
decore(tthree, lthree, "Age : ", pthree);
JLabel lfour = new JLabel();
JPanel pfour = new JPanel();
decore(tfour, lfour, "Gender : ", pfour);
JLabel lfive = new JLabel();
JPanel pfive = new JPanel();
decore(tfive, lfive, "Phone no. : ", pfive);
JLabel lsix = new JLabel();
JPanel psix = new JPanel();
decore(tsix, lsix, "Address : ", psix);
JPanel p3 = new JPanel();
p3.setBounds(150, 25, 400, 500);
p3.setBackground(new Color(0xDAF5FF));
p3.setLayout(new GridLayout(6, 1, 0, 20));
p3.add(pone);
p3.add(ptwo);
p3.add(pthree);
p3.add(pfour);
p3.add(pfive);
p3.add(psix);
JPanel p2 = new JPanel();
p2.setBounds(40, 100, 700, 560);
p2.setBackground(new Color(0xDAF5FF));
p2.setLayout(null);
p2.add(p3);
JLabel l1 = new JLabel();
l1.setBounds(0,0,800, 100);
l1.setText("Please enter your Details below.");
l1.setFont(new Font("Comic Sans", Font.BOLD, 35));
l1.setForeground(Color.WHITE);
l1.setHorizontalAlignment(JLabel.CENTER);
l1.setVerticalAlignment(JLabel.CENTER);
JPanel p1 = new JPanel();
p1.setBounds(0, 0, 800, 100);
p1.setBackground(new Color(0x0B2447));
p1.setLayout(null);
p1.add(l1);
frame.setBounds(350, 0, 800, 800);
frame.setResizable(false);
frame.setTitle("Neutron Pharmacy");
frame.setLayout(null);
frame.setBackground(Color.white);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(p1);
frame.add(p2);
frame.add(btn);
frame.setVisible(true);
}
}