-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathViewCustomer.java
149 lines (116 loc) · 4.89 KB
/
ViewCustomer.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package travel_and_Tourism_Organisation_System;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
public class ViewCustomer extends JFrame implements ActionListener {
JButton back;
ViewCustomer(String username){
setBounds(340,120,850, 550);
getContentPane().setBackground(Color.cyan);
setLayout(null);
JLabel lblName = new JLabel("VIEW CUSTOMER DETAILS");
lblName.setFont(new Font("Yu Mincho", Font.PLAIN, 20));
lblName.setBounds(118,5, 300, 53);
add(lblName);
JLabel lblusername= new JLabel("Username");
lblusername.setBounds(30,50,150,25);
add(lblusername);
JLabel labelusername= new JLabel();
labelusername.setBounds(220,50,150,25);
add(labelusername);
JLabel lblid= new JLabel("Id");
lblid.setBounds(30,110,150,25);
add(lblid);
JLabel labelid= new JLabel();
labelid.setBounds(220,110,150,25);
add(labelid);
JLabel lblnumber= new JLabel("Number");
lblnumber.setBounds(30,170,150,25);
add(lblnumber);
JLabel labelnumber= new JLabel();
labelnumber.setBounds(220,170,150,25);
add(labelnumber);
JLabel lblname= new JLabel("Name");
lblname.setBounds(30,230,150,25);
add(lblname);
JLabel labelname= new JLabel();
labelname.setBounds(220,230,150,25);
add(labelname);
JLabel lblgender= new JLabel("Gender");
lblgender.setBounds(30,290,150,25);
add(lblgender);
JLabel labelgender= new JLabel();
labelgender.setBounds(220,290,150,25);
add(labelgender);
JLabel lblcountry= new JLabel("Country");
lblcountry.setBounds(500,50,150,25);
add(lblcountry);
JLabel labelcountry= new JLabel();
labelcountry.setBounds(690,50,150,25);
add(labelcountry);
JLabel lbladdress= new JLabel("Address");
lbladdress.setBounds(500,110,150,25);
add(lbladdress);
JLabel labeladdress= new JLabel();
labeladdress.setBounds(690,110,150,25);
add(labeladdress);
JLabel lblphone= new JLabel("Phone");
lblphone.setBounds(500,170,150,25);
add(lblphone);
JLabel labelphone= new JLabel();
labelphone.setBounds(690,170,150,25);
add(labelphone);
JLabel lblemail= new JLabel("Email");
lblemail.setBounds(500,230,150,25);
add(lblemail);
JLabel labelemail= new JLabel();
labelemail.setBounds(690,230,150,25);
add(labelemail);
back = new JButton("Back");
back.setBounds(350, 320, 100, 25);
back.setBackground(Color.BLACK);
back.setForeground(Color.WHITE);
add(back);
back.addActionListener(this);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("travel_and_Tourism_Organisation_System/icons/viewall.jpg"));
Image i3 = i1.getImage().getScaledInstance(626,190,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel l1 = new JLabel(i2);
l1.setBounds(0,350,626,201);
add(l1);
ImageIcon i4 = new ImageIcon(ClassLoader.getSystemResource("travel_and_Tourism_Organisation_System/icons/viewall.jpg"));
Image i5 = i4.getImage().getScaledInstance(626,190,Image.SCALE_DEFAULT);
ImageIcon i6 = new ImageIcon(i5);
JLabel l2 = new JLabel(i6);
l2.setBounds(615,350,626,201);
add(l2);
try{
Conn conn = new Conn();
String query = "select * from customer where username='"+username+"'";
ResultSet rs = conn.s.executeQuery(query);
while(rs.next()) {
labelusername.setText(rs.getString("username"));
labelid.setText(rs.getString("id"));
labelnumber.setText(rs.getString("number"));
labelname.setText(rs.getString("name"));
labelgender.setText(rs.getString("gender"));
labelcountry.setText(rs.getString("country"));
labeladdress.setText(rs.getString("address"));
labelphone.setText(rs.getString("phone"));
labelemail.setText(rs.getString("email"));
}
}
catch(Exception e1){
e1.printStackTrace();
}
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
setVisible(false);
}
public static void main(String[] args) {
new ViewCustomer("username");
}
}