-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeterinfo.java
More file actions
150 lines (121 loc) · 4.72 KB
/
meterinfo.java
File metadata and controls
150 lines (121 loc) · 4.72 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
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
150
package electricity.billing.system;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
public class meterinfo extends JFrame implements ActionListener{
JButton Next;
Choice meterlocation,metertype, phasecode, billtype;
String meternumber;
meterinfo(String meternumber){
this.meternumber= meternumber;
setSize(700,500);
setLocation(400,200);
JPanel p= new JPanel();
p.setLayout(null);
p.setBackground((new Color(173, 216, 230)));
add(p);
JLabel heading= new JLabel("Meter Information");
heading.setBounds(180, 30, 200, 25);
heading.setFont(new Font("Tahoma",Font.PLAIN, 24 ));
p.add(heading);
JLabel lblname= new JLabel("Meter No.");
lblname.setBounds(100, 80, 100, 20);
p.add(lblname);
JLabel lblmeternumber= new JLabel(meternumber);
lblmeternumber.setBounds(240, 80, 100, 20);
p.add(lblmeternumber);
JLabel lblmeterloc= new JLabel("Meter Location");
lblmeterloc.setBounds(100, 120, 100, 20);
p.add(lblmeterloc);
meterlocation= new Choice();
meterlocation.add("outside");
meterlocation.add("Inside");
meterlocation.setBounds(240, 120, 200, 20);
p.add(meterlocation);
JLabel lbladd= new JLabel("Meter Type");
lbladd.setBounds(100, 160, 100, 20);
p.add(lbladd);
metertype= new Choice();
metertype.add("Electric Meter ");
metertype.add("Solar Meter");
metertype.add("Smart Meter");
metertype.setBounds(240, 160, 200, 20);
p.add(metertype);
JLabel lblstate= new JLabel("Phase Code");
lblstate.setBounds(100, 200, 100, 20);
p.add(lblstate);
phasecode= new Choice();
phasecode.add(" 011 ");
phasecode.add(" 022");
phasecode.add(" 033");
phasecode.add(" 044");
phasecode.add(" 055");
phasecode.add(" 066");
phasecode.add(" 077");
phasecode.add(" 088");
phasecode.add(" 099");
phasecode.setBounds(240, 200, 200, 20);
p.add(phasecode);
JLabel lblcity= new JLabel("Bill Type");
lblcity.setBounds(100, 240, 100, 20);
p.add(lblcity);
billtype= new Choice();
billtype.add("Normal");
billtype.add("Industrial");
billtype.setBounds(240, 240, 200, 20);
p.add(billtype);
JLabel lblemail= new JLabel("Days");
lblemail.setBounds(100, 280, 100, 20);
p.add(lblemail);
JLabel lblemails= new JLabel("30 Days");
lblemails.setBounds(240, 280, 100, 20);
p.add(lblemails);
JLabel lblphn= new JLabel("Note");
lblphn.setBounds(100, 320, 100, 20);
p.add(lblphn);
JLabel lblphns= new JLabel("By Default Bill is Calculated 30 Days only");
lblphns.setBounds(240, 320, 500, 20);
p.add(lblphns);
Next = new JButton("Subit");
Next.setBounds(220,390,100,25);
Next.addActionListener(this);
p.add(Next);
setLayout(new BorderLayout());
add(p, "Center");
ImageIcon i1= new ImageIcon(ClassLoader.getSystemResource("icon/hicon1.jpg"));
Image i2= i1.getImage().getScaledInstance(150, 300,Image.SCALE_DEFAULT);
ImageIcon i3= new ImageIcon(i2);
JLabel image = new JLabel(i3);
add(image, "West");
getContentPane().setBackground(Color.WHITE);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent ae){
if(ae.getSource()==Next){
String meter= meternumber;
String location= meterlocation.getSelectedItem();
String type= metertype.getSelectedItem();
String code = phasecode.getSelectedItem();
String typebill= billtype.getSelectedItem();
String days= "30";
String query= "insert into meter_info values('"+meter+"', '"+location+"', '"+type+"', '"+code+"', '"+typebill+"', '"+days+"')";
try{
Conn c= new Conn();
c.s.executeUpdate(query);
JOptionPane.showConfirmDialog(null, "Meter Information Added Successfully");
setVisible(false);
//frame
}catch(Exception e){
e.printStackTrace();
}
}
else{
setVisible(false);
}
}
public static void main (String[] args){
new meterinfo("");
}
}