-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrdersDesign.java
More file actions
106 lines (102 loc) · 3.07 KB
/
OrdersDesign.java
File metadata and controls
106 lines (102 loc) · 3.07 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
package bb_management;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class OrdersDesign extends JFrame implements ActionListener{
JButton addBtn, editBtn, searchBtn, deleteBtn;
JLabel desc;
JTextField n;
Color c1 = new Color(230, 51, 51);
Color c2 = new Color(77, 0, 0);
Color c3 = new Color(255, 255, 255);
OrdersDesign(){
setTitle("Orders");
getContentPane().setBackground(c1);
setBackground(Color.CYAN);
getContentPane().setForeground(Color.WHITE);
getContentPane().setLayout(null);
JLabel label = new JLabel("Order Details Management");
label.setFont(new Font("SANS_SERIF", Font.BOLD, 22));
label.setForeground(Color.white);
label.setBounds(118, 0, 380, 40);
getContentPane().add(label);
setBounds(100, 100, 600, 700);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
desc = new JLabel("Hospital ID: ");
n = new JTextField("H001", 5);
addBtn = new JButton("Add new order");
editBtn = new JButton("Edit details of order");
searchBtn = new JButton("Search");
deleteBtn = new JButton("Delete Order");
addBtn.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
editBtn.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
searchBtn.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
deleteBtn.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
addBtn.setBackground(c3);
addBtn.setForeground(c2);
editBtn.setBackground(c3);
editBtn.setForeground(c2);
searchBtn.setBackground(c3);
searchBtn.setForeground(c2);
deleteBtn.setBackground(c3);
deleteBtn.setForeground(c2);
addBtn.addActionListener(this);
editBtn.addActionListener(this);
searchBtn.addActionListener(this);
deleteBtn.addActionListener(this);
addBtn.setBounds(15, 70, 260, 60);
editBtn.setBounds(15, 160, 260, 60);
searchBtn.setBounds(310, 160, 260, 60);
deleteBtn.setBounds(310, 70, 260, 60);
add(addBtn, BorderLayout.WEST);
add(editBtn, BorderLayout.WEST);
add(searchBtn, BorderLayout.EAST);
add(deleteBtn, BorderLayout.EAST);
desc.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
n.setFont(new Font("SANS_SERIF", Font.BOLD, 16));
desc.setBounds(150, 250, 260, 60);
n.setBounds(250, 250, 160, 60);
add(addBtn);
add(desc);
add(n);
add(editBtn);
add(searchBtn);
add(deleteBtn);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
Orders obj = new Orders();
if (ae.getSource() == addBtn) {
try {
obj.add();
} catch (Exception e) {
e.printStackTrace();
}
repaint();
}
else if (ae.getSource() == editBtn) {
try {
obj.edit(n.getText());
} catch (Exception e) {
e.printStackTrace();
}
repaint();
}
else if (ae.getSource() == searchBtn) {
try {
obj.search(n.getText());
} catch (Exception e) {
e.printStackTrace();
}
repaint();
}
else if (ae.getSource() == deleteBtn) {
try {
obj.delete(n.getText());
} catch (Exception e) {
e.printStackTrace();
}
repaint();
}
}
}