-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBk_Status.java
65 lines (50 loc) · 1.64 KB
/
Bk_Status.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
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.*;
public class Bk_Status extends MouseAdapter implements ActionListener{
Object[][] data;
int click;
JTable table;
JButton ret;
double sum=0.0d;
JFrame frame;
Bk_Status()
{
JLabel empty=new JLabel("No Books", null, click);
frame = new JFrame("Library Book Status");
frame.setLayout(new BorderLayout());
ret=new JButton("ADD MORE", null);
ret.setVisible(false);
ret.addActionListener(this);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
data=Main.obj.bkData(data);
if(data.length>1)
{
String names[]={"Book ID","Name","ISBN","Price","Quantity","Issued","Total Books"};
DefaultTableModel model = new DefaultTableModel(data, names);
table = new JTable(model);
table.addMouseListener(this);
JScrollPane scrollPane = new JScrollPane(table);
frame.add(scrollPane, BorderLayout.CENTER);
frame.add(ret, BorderLayout.SOUTH);
}
else
frame.add(empty,BorderLayout.CENTER);
frame.setSize(900, 500);
frame.setVisible(true);
}
public void mouseClicked(MouseEvent ae)
{
click = table.rowAtPoint(ae.getPoint());
ret.setText("Add More "+data[click][1]);
ret.setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
Main.obj.addQty((int)data[click][0]);
frame.setVisible(false);
frame.dispose();
new Bk_Status();
}
}