-
Notifications
You must be signed in to change notification settings - Fork 2
/
AddItems.java
132 lines (99 loc) · 3.96 KB
/
AddItems.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
package canteen.management.system;
import java.awt.*;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.event.*;
public class AddItems extends JFrame implements ActionListener{
JTextField t1,t2;
JComboBox c1,c2,c3;
JButton b1,b2;
AddItems(){
super("CONTACLESS COMPUTERIZED CANTEEN MANAGEMENT SYSTEM");
JLabel l1 = new JLabel("ADD TABLES");
l1.setBounds(140,20,120,20);
l1.setFont(new Font("Tahoma",Font.BOLD,18));
add(l1);
JLabel table = new JLabel("Table Number");
table.setBounds(60, 80, 120, 30);
table.setFont(new Font("Tahoma",Font.PLAIN,16));
add(table);
t1 = new JTextField();
t1.setBounds(200, 80, 150, 30);
add(t1);
JLabel available = new JLabel("Available");
available.setFont(new Font("Tahoma", Font.PLAIN, 16));
available.setBounds(64, 130, 120, 30);
add(available);
c1 = new JComboBox(new String[] { "Available", "Occupied" });
c1.setBounds(200, 130, 150, 30);
c1.setBackground(Color.WHITE);
add(c1);
JLabel status = new JLabel("Cleaning status");
status.setBounds(60, 180, 120, 30);
status.setFont(new Font("Tahoma",Font.PLAIN,16));
add(status);
c2 = new JComboBox(new String[] { "Sanitized", "UnSanitized" });
c2.setBounds(200, 180, 150, 30);
c2.setBackground(Color.WHITE);
add(c2);
JLabel price = new JLabel("Service Charges");
price.setBounds(60, 230, 120, 30);
price.setFont(new Font("Tahoma",Font.PLAIN,16));
add(price);
t2 = new JTextField();
t2.setBounds(200, 230, 150, 30);
add(t2);
JLabel type = new JLabel("Table type");
type.setBounds(60, 280, 120, 30);
type.setFont(new Font("Tahoma",Font.PLAIN,16));
add(type);
c3 = new JComboBox(new String[] { "Single Table 8/4", "Double Table 16/8" });
c3.setBackground(Color.WHITE);
c3.setBounds(200, 280, 150, 30);
add(c3);
b1 = new JButton("Add Table");
b1.setBounds(60, 350,130 ,30 );
b1.setBackground(Color.BLACK);
b1.setForeground(Color.white);
b1.addActionListener(this);
add(b1);
b2 = new JButton("Cancel");
b2.setBounds(220, 350,130 ,30 );
b2.setBackground(Color.BLACK);
b2.setForeground(Color.white);
b2.addActionListener(this);
add(b2);
//ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("canteen/management/system/icons/CMS22.jpg "));
//JLabel l5 = new JLabel(i1);
//l5.setBounds(400, 30 , 500 , 350 );
//add(l5);
getContentPane().setBackground(Color.WHITE);
setBounds(570,200,500,500);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
if(ae.getSource()==b1){
String table = t1.getText();
String available = (String)c1.getSelectedItem();
String status = (String)c2.getSelectedItem();
String price = t2.getText();
String type = (String)c3.getSelectedItem();
conn c =new conn();
try{
String str = "insert into addtables values('"+table+"','"+available+"','"+status+"','"+price+"','"+type+"')";
c.s.executeUpdate(str);
JOptionPane.showMessageDialog(null, "New Table Added");
this.setVisible(false);
}catch(Exception e){
System.out.println(e);
}
}else if(ae.getSource()==b2){
new Dashboard().setVisible(true);
this.setVisible(false);
}
}
public static void main(String[] args){
new AddItems().setVisible(true);
}
}