-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.java
More file actions
143 lines (141 loc) · 5.9 KB
/
Copy pathProject.java
File metadata and controls
143 lines (141 loc) · 5.9 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chemist_shop;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.UIManager.*;
public class Project extends JFrame implements ActionListener
{
Font f1 = new Font("Courier New", Font.ITALIC,26);
JLabel l1;
public Project()
{
l1 = new JLabel("");
l1.setOpaque(true);
l1.setBackground(Color.pink);
add(l1);
setFont(f1);
setSize(1000,1000);
JMenuBar mb = new JMenuBar();
//mb.acceleratorFont(f1);
setJMenuBar(mb);
mb.setFont(f1);
JMenu first = new JMenu("Master");
first.setForeground(Color.red);
first.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\master.png")));
mb.add(first);
JMenuItem t1 = new JMenuItem("New Account");
t1.setForeground(Color.red);
t1.setMnemonic('U');
t1.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\new_user.png")));
t1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,ActionEvent.CTRL_MASK));
t1.setFont(f1);
first.add(t1);
JMenuItem t2 = new JMenuItem("New Medicine");
t2.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\new_med.png")));
t2.setForeground(Color.red);
t2.setMnemonic('N');
t2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,ActionEvent.CTRL_MASK));
//t2.acceleratorFont(f1);
t2.setFont(f1);
first.add(t2);
t1.addActionListener(this);
JMenuItem t9 = new JMenuItem("New Customer");
t9.setMnemonic('C');
t9.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\new_cus.png")));
t9.setForeground(Color.red);
t9.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK));
t9.setFont(f1);
first.add(t9);
t9.addActionListener(this);
t2.addActionListener(this);
JMenuItem t3 = new JMenuItem("Update Medicine");
t3.setMnemonic('M');
t3.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\update_med.png")));
t3.setForeground(Color.red);
t3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M,ActionEvent.CTRL_MASK));
t3.setFont(f1);
first.add(t3);
t3.addActionListener(this);
JMenuItem t4 = new JMenuItem("Delete Medicine");
t4.setMnemonic('Z');
t4.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\delete_med.png")));
t4.setForeground(Color.red);
t4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z,ActionEvent.CTRL_MASK));
t4.setFont(f1);
first.add(t4);
t4.addActionListener(this);
JMenu second = new JMenu("Reports");
second.setForeground(Color.red);
second.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\report.png")));
mb.add(second);
JMenuItem t5 = new JMenuItem("List Users");
t5.setMnemonic('L');
t5.setForeground(Color.red);
t5.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\list_users.png")));
t5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L,ActionEvent.CTRL_MASK));
t5.setFont(f1);
second.add(t5);
t5.addActionListener(this);
JMenuItem t6 = new JMenuItem("List Medicines");
t6.setMnemonic('P');
t6.setForeground(Color.red);
t6.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\list_med.png")));
t6.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,ActionEvent.CTRL_MASK));
t6.setFont(f1);
second.add(t6);
t6.addActionListener(this);
JMenuItem t7 = new JMenuItem("Cart");
t7.setMnemonic('X');
t7.setForeground(Color.red);
t7.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\cart.png")));
t7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,ActionEvent.CTRL_MASK));
t7.setFont(f1);
second.add(t7);
t7.addActionListener(this);
JMenuItem t8 = new JMenuItem("List Customers");
t8.setMnemonic('F');
t8.setForeground(Color.red);
t8.setIcon(new ImageIcon(ClassLoader.getSystemResource("Icon\\list_users.png")));
t8.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F,ActionEvent.CTRL_MASK));
t8.setFont(f1);
second.add(t8);
t8.addActionListener(this);
first.setFont(f1);
second.setFont(f1);
}
public void actionPerformed(ActionEvent ae)
{
String msg = ae.getActionCommand();
if(msg.equals("New Account"))
new user_account().setVisible(true);
if(msg.equals("New Medicine"))
new new_medicine().setVisible(true);
if(msg.equals("New Customer"))
new new_customer().setVisible(true);
if(msg.equals("Delete Medicine"))
new delete_medicine().setVisible(true);
if(msg.equals("Update Medicine"))
new update_medicine().setVisible(true);
if(msg.equals("Cart"))
new cart().setVisible(true);
if(msg.equals("List Medicines"))
new list_medicine().setVisible(true);
if(msg.equals("List Users"))
new list_users().setVisible(true);
if(msg.equals("List Customers"))
new list_customers().setVisible(true);
}
public static void main(String s[])
{
Font f = new Font("Courier New", Font.ITALIC,22);
UIManager.getLookAndFeelDefaults().put("MenuItem.acceleratorFont", f);
UIManager.getLookAndFeelDefaults().put("MenuItem.acceleratorForeground", Color.black);
new Project().setVisible(true);
}
}