-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewinformation.java
More file actions
108 lines (92 loc) · 3.58 KB
/
viewinformation.java
File metadata and controls
108 lines (92 loc) · 3.58 KB
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
package electricity.billing.system;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
public class viewinformation extends JFrame implements ActionListener{
JButton cancel;
viewinformation(String meter){
setBounds(350, 150, 850, 650);
getContentPane().setBackground(Color.WHITE);
setLayout(null);
JLabel heading = new JLabel("View Customer Information");
heading.setBounds(250,0,500,40);
heading.setFont(new Font("Tohma",Font.PLAIN, 20));
add(heading);
JLabel lblname = new JLabel("Name");
lblname.setBounds(70,80,100,20);
add(lblname);
JLabel name = new JLabel("");
name.setBounds(250,80,100,20);
add(name);
JLabel lblmeternumber = new JLabel("Meter Number");
lblmeternumber.setBounds(70,140,100,20);
add(lblmeternumber);
JLabel meternumber = new JLabel("");
meternumber.setBounds(250,140,100,20);
add(meternumber);
JLabel lbladdress= new JLabel("Address");
lbladdress.setBounds(70,200,100,20);
add(lbladdress);
JLabel address = new JLabel("");
address.setBounds(250,200,100,20);
add(address);
JLabel lblcity= new JLabel("City");
lblcity.setBounds(70,260,100,20);
add(lblcity);
JLabel city = new JLabel("");
city.setBounds(250,260,100,20);
add(city);
JLabel lblstate= new JLabel("State");
lblstate.setBounds(500,80,100,20);
add(lblstate);
JLabel state = new JLabel("");
state.setBounds(650,80,100,20);
add(state);
JLabel lblemail= new JLabel("Email");
lblemail.setBounds(500,140,100,20);
add(lblemail);
JLabel email = new JLabel("");
email.setBounds(650,140,100,20);
add(email);
JLabel lblphone= new JLabel("Phone No.");
lblphone.setBounds(500,200,100,20);
add(lblphone);
JLabel phone = new JLabel("");
phone.setBounds(650,200,100,20);
add(phone);
try{
Conn c = new Conn();
ResultSet rs = c.s.executeQuery("select * from customer where meter='"+meter+"'");
while(rs.next()){
name.setText(rs.getString("name"));
address.setText(rs.getString("address"));
city.setText(rs.getString("city"));
state.setText(rs.getString("state"));
email.setText(rs.getString("email"));
phone.setText(rs.getString("phn"));
meternumber.setText(rs.getString("meter"));
}
}
catch(Exception e){
e.printStackTrace();
}
cancel = new JButton("Cancel");
cancel.setBounds(350,340,100,25);
cancel.addActionListener(this);
add(cancel);
ImageIcon i1= new ImageIcon(ClassLoader.getSystemResource("icon/viewcustomer.jpg"));
Image i2 = i1.getImage().getScaledInstance(600, 300, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image= new JLabel(i3);
image.setBounds(20,350,600,300);
add(image);
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
setVisible(false);
}
public static void main(String[] args){
new viewinformation("");
}
}