-
Notifications
You must be signed in to change notification settings - Fork 161
/
Back.java.java
110 lines (106 loc) · 2.87 KB
/
Back.java.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
//Back.java;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Date;
import java.util.*;
import java.text.*;
import javax.swing.JOptionPane;
public class Back extends Frame {
/**
*
*/
private static final long serialVersionUID = 7670129939284773294L;
Label bookidlb = new Label("图书编号"), readeridlb = new Label("读者编号");
TextField bookidtxt = new TextField(), readeridtxt = new TextField();
Button querybtn = new Button("查询"), borrowbtn = new Button("还书"),
closebtn = new Button("退出");
String SepLine = "--------------------------------------------------";
String[] sep = { "图书信息", "读者信息", "借阅信息" };
Label[] seplabel = new Label[3];
String[] optionname = { "书名:", "作者:", "出版社:", "出版时间:", "定价:", "存量:", "姓名:",
"类型:", "可借数:", "可借天数:", "还书日期:" };
Label[] alloption = new Label[11];
Label[] showoption = new Label[11];
public Back() {
setTitle("Book Back");
setLayout(null);
setSize(500, 470);
setResizable(false);
this.setForeground(Color.BLACK);
bookidlb.setBounds(50, 50, 50, 20);
bookidtxt.setBounds(110, 50, 100, 20);
readeridlb.setBounds(220, 50, 50, 20);
readeridtxt.setBounds(280, 50, 100, 20);
querybtn.setBounds(400, 50, 50, 20);
add(bookidlb);
add(bookidtxt);
add(readeridlb);
add(readeridtxt);
add(querybtn);
int lx = 50, ly = 90, i = 0, k = 0;
for (int j = 0; j < alloption.length; j++) {
if (lx > 300) {
lx = 50;
ly = ly + 30;
}
if (ly == 90 || ly == 210 || ly == 300) {
System.out.println(i);// /太奇怪了
seplabel[i] = new Label(SepLine + sep[i] + SepLine);
seplabel[i].setBounds(20, ly, 440, 20);
add(seplabel[i]);
j--;
k++;
if (k <= 1) {
i = 0;
}
if (k == 2 || k == 3) {
i = 1;
}
if (k == 4) {
i = 2;
}
} else {
alloption[j] = new Label(optionname[j]);
showoption[j] = new Label("");
alloption[j].setBounds(lx, ly, 70, 20);
showoption[j].setBounds(lx + 70, ly, 150, 20);
add(alloption[j]);
add(showoption[j]);
}
lx = lx + 250;
}
borrowbtn.setBounds(110, 400, 50, 20);
closebtn.setBounds(310, 400, 50, 20);
add(borrowbtn);
add(closebtn);
borrowbtn.setEnabled(false);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
//System.exit(0);
}
});
querybtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//queryActionPerformed(e);
}
});
borrowbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//borrowActionPerformed(e);
}
});
closebtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DbOp.close();
dispose();
}
});
setLocationRelativeTo(null);
setVisible(true);
}
public static void main(String[] args){
new Back();
}
}