📄 win1.java
字号:
c = Integer.parseInt(textField_423.getText());
} catch (Exception e) {
p3 = 1;
}
if (p1 == 0 && p2 == 0 && p3 == 0) {
try {
Calculator tj = (Calculator) Naming
.lookup("rmi://localhost/CalculatorService");
sf = tj.reader(a, b, c, d, t, f, 0);
} catch (RemoteException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// System.out.print(sf);
if (sf == false) {
JOptionPane.showMessageDialog(null, "已经有这个读者,无法添加读者");
} else {
JOptionPane.showMessageDialog(null, "添加成功");
}
}
if (p1 == 1) {
textField_221.setText("");
JOptionPane.showMessageDialog(null, "读者识别号输入不合法,请输入数字");
}
if (p2 == 1) {
textField_625.setText("");
JOptionPane.showMessageDialog(null, "联系电话输入不合法,请输入数字");
}
if (p3 == 1) {
textField_423.setText("");
JOptionPane.showMessageDialog(null, "读者权限输入不合法,请输入数字");
}
}
});
per++;
final JButton button_121 = new JButton();
button_121.setText("删除");
button_121.setBounds(401, 272, 99, 23);
p2.add(button_121);
final JButton button_131 = new JButton();
button_131.setText("修改");
button_131.setBounds(401, 322, 99, 23);
p2.add(button_131);
per++;
button_131.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
boolean sf = false;
int p1 = 0;
int p2 = 0;
int p3 = 0;
String b = "";
int c = 0;
String d = "";
double t = 0;
String f = "";
int a = 0;
b = textField_322.getText();
d = textField_524.getText();
f = textField_726.getText();
try {
a = Integer.parseInt(textField_221.getText());
} catch (Exception e) {
p1 = 1;
}
try {
t = Double.parseDouble(textField_625.getText());
} catch (Exception e) {
p2 = 1;
}
try {
c = Integer.parseInt(textField_423.getText());
} catch (Exception e) {
p3 = 1;
}
if (p1 == 0 && p2 == 0 && p3 == 0) {
try {
Calculator tj = (Calculator) Naming
.lookup("rmi://localhost/CalculatorService");
sf = tj.reader(a, b, c, d, t, f, 1);
} catch (RemoteException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// System.out.print(sf);
if (sf == false) {
JOptionPane.showMessageDialog(null, "没有这个读者,修改读者信息错误");
} else {
JOptionPane.showMessageDialog(null, "修改成功");
}
}
if (p1 == 1) {
textField_221.setText("");
JOptionPane.showMessageDialog(null, "读者识别号输入不合法,请输入数字");
}
if (p2 == 1) {
textField_625.setText("");
JOptionPane.showMessageDialog(null, "联系电话输入不合法,请输入数字");
}
if (p3 == 1) {
textField_423.setText("");
JOptionPane.showMessageDialog(null, "读者权限输入不合法,请输入数字");
}
}
});
per++;
final JButton button_141 = new JButton();
button_141.setText("上移");
button_141.setBounds(401, 122, 99, 23);
p2.add(button_141);
final JPanel p3 = new JPanel();
p3.setBounds(184, 0, 522, 468);
系统管理.add(p3);
p3.setVisible(false);
// 3卡!!!!!!!!!!!!!!!!!!!!!!!!
p3.setLayout(null);
final JLabel label31 = new JLabel();
label31.setText("图书总量");
label31.setBounds(55, 73, 60, 15);
p3.add(label31);
final JLabel label_132 = new JLabel();
label_132.setText("读者总量");
label_132.setBounds(55, 193, 60, 15);
p3.add(label_132);
per++;
final JLabel label_233 = new JLabel();
label_233.setText("在库图书");
label_233.setBounds(55, 313, 60, 15);
p3.add(label_233);
tj1 = c.tj();
textArea31 = new JTextArea();
textArea31.setEditable(false);
textArea31.setText(tj1[0]);
textArea31.setBounds(159, 69, 280, 24);
p3.add(textArea31);
textArea_232 = new JTextArea();
textArea_232.setEditable(false);
textArea_232.setText(tj1[1]);
textArea_232.setBounds(159, 189, 280, 24);
p3.add(textArea_232);
per++;
textArea_333 = new JTextArea();
textArea_333.setEditable(false);
textArea_333.setText(tj1[2]);
textArea_333.setBounds(159, 309, 280, 24);
p3.add(textArea_333);
final JPanel p4 = new JPanel();
p4.setBounds(184, 0, 522, 468);
系统管理.add(p4);
p4.setVisible(false);
// 4卡!!!!!!!!!!!!!!!!11
p4.setLayout(null);
final JLabel label41 = new JLabel();
label41.setText("读者权限");
label41.setBounds(55, 68, 60, 15);
p4.add(label41);
final JLabel label_142 = new JLabel();
label_142.setText("最多借书本数");
label_142.setBounds(55, 168, 90, 15);
p4.add(label_142);
per++;
final JLabel label_243 = new JLabel();
label_243.setText("最长借阅时间");
label_243.setBounds(55, 268, 90, 15);
p4.add(label_243);
textField_242 = new JTextField();
textField_242.setBounds(159, 165, 280, 21);
p4.add(textField_242);
textField_343 = new JTextField();
textField_343.setBounds(159, 265, 280, 21);
p4.add(textField_343);
per++;
final JButton button41 = new JButton();
button41.setText("更改");
button41.setBounds(340, 350, 99, 23);
p4.add(button41);
per++;
String[] p={"1","2","3","4","5"};
final JComboBox comboBox_13 = new JComboBox(p);
comboBox_13.setBounds(159, 65, 120, 21);
comboBox_13.addActionListener(this);
p4.add(comboBox_13);
final JPanel p7 = new JPanel();
p7.setBounds(184, 0, 522, 468);
系统管理.add(p7);
p7.setVisible(false);
// 7卡!!!!!!!!!!!!!!!!!!!!!!!!1
p7.setLayout(null);
final JLabel labelx = new JLabel();
labelx.setText("操作员号码");
labelx.setBounds(95, 65, 100, 15);
p7.add(labelx);
per++;
final JLabel label_1x = new JLabel();
label_1x.setText("原口令");
label_1x.setBounds(95, 125, 60, 15);
p7.add(label_1x);
final JLabel label_2x = new JLabel();
label_2x.setText("新口令");
label_2x.setBounds(95, 184, 60, 15);
p7.add(label_2x);
final JLabel label_3x = new JLabel();
label_3x.setText("确认新口令");
label_3x.setBounds(95, 244, 100, 15);
p7.add(label_3x);
textField71 = new JTextField();
textField71.setBounds(161, 62, 265, 21);
p7.add(textField71);
per++;
passwordField1 = new JPasswordField();
passwordField1.setBounds(161, 122, 265, 21);
p7.add(passwordField1);
per++;
passwordField_2 = new JPasswordField();
passwordField_2.setBounds(161, 181, 265, 21);
p7.add(passwordField_2);
passwordField_3 = new JPasswordField();
passwordField_3.setBounds(161, 241, 265, 21);
p7.add(passwordField_3);
final JButton button77 = new JButton();
button77.setText("修改口令");
button77.setBounds(206, 298, 99, 23);
p7.add(button77);
p1.setVisible(true);
p5.setVisible(false);
p6.setVisible(false);
// 5卡!!!!!!!!!!!!!!!!!!!!!!!1
p5.setLayout(null);
p5.setBounds(184, 0, 522, 468);
系统管理.add(p5);
// sdsddddddddd
// sdsddddddddd
DefaultMutableTreeNode top = new DefaultMutableTreeNode(new IconData1(
ICON_COMPUTER, null, "我的电脑"));
per++;
DefaultMutableTreeNode node;
File[] roots = c.data();
for (int k = 0; k < roots.length; k++) {
node = new DefaultMutableTreeNode(new IconData1(ICON_DISK, null,
new FileNode1(roots[k])));
top.add(node);
node.add(new DefaultMutableTreeNode(new Boolean(true)));
}
model = new DefaultTreeModel(top);
m_tree = new JTree(model);
m_tree.putClientProperty("JTree.lineStyle", "Angled");
TreeCellRenderer renderer = new IconCellRenderer1();
m_tree.setCellRenderer(renderer);
per++;
m_tree.addTreeExpansionListener(new DirExpansionListener1());
m_tree.addTreeSelectionListener(new DirSelectionListener1());
m_tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION);
m_tree.setShowsRootHandles(true);
m_tree.setEditable(false);
// ddddddddddddd
per++;
final JLabel label51 = new JLabel();
label51.setText("文件路径");
label51.setBounds(45, 40, 60, 15);
p5.add(label51);
final JLabel label_152 = new JLabel();
label_152.setText("文件目录");
label_152.setBounds(45, 88, 60, 15);
p5.add(label_152);
per++;
final JLabel label_253 = new JLabel();
label_253.setText("文件名称");
label_253.setBounds(45, 351, 60, 15);
p5.add(label_253);
textField51 = new JTextField();
textField51.setEditable(false);
textField51.setBounds(111, 37, 342, 21);
p5.add(textField51);
JScrollPane tt = new JScrollPane(m_tree);
tt.setBounds(111, 87, 342, 255);
p5.add(tt);
textField_252 = new JTextField();
textField_252.setBounds(111, 348, 342, 21);
p5.add(textField_252);
per++;
final JButton 存储 = new JButton();
存储.setText("存储");
存储.setBounds(340, 391, 99, 23);
p5.add(存储);
存储.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String sd=textField_252.getText();
FileInputStream fis;
try {
Calculator wt = (Calculator) Naming
.lookup("rmi://localhost/CalculatorService");
wt.write(path,sd);
JOptionPane.showMessageDialog(null, "备份数据库成功");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.print("找不到文件");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
// TODO Auto-generated catch block
System.out.print("数据库备份错误");
}
}
});
per++;
// WindowListener wndCloser = new WindowAdapter()
// {
// public void windowClosing(WindowEvent e)
// {
// System.exit(0);
// }
// };
// addWindowListener(wndCloser);
// 6卡!!!!!!!!!!!!!!!!!!!!!
p6.setLayout(null);
系统管理.add(p6);
p6.setBounds(184, 0, 522, 468);
DefaultMutableTreeNode top1 = new DefaultMutableTreeNode(new IconData(
ICON_COMPUTER, null, "我的电脑"));
DefaultMutableTreeNode node1;
File[] roots1 = c.data1();
for (int k = 0; k < roots1.length; k++) {
node1 = new DefaultMutableTreeNode(new IconData(ICON_DISK, null,
new FileNode(roots1[k])));
top1.add(node1);
node1.add(new DefaultMutableTreeNode(new Boolean(true)));
}
per++;
model1 = new DefaultTreeModel(top1);
n_tree = new JTree(model1);
n_tree.putClientProperty("JTree.lineStyle", "Angled");
TreeCellRenderer renderer1 = new IconCellRenderer();
n_tree.setCellRenderer(renderer1);
n_tree.addTreeExpansionListener(new DirExpansionListener());
n_tree.addTreeSelectionListener(new DirSelectionListener());
n_tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION);
n_tree.setShowsRootHandles(true);
n_tree.setEditable(false);
// ddddddddddddd
final JLabel label61 = new JLabel();
label61.setText("文件路径");
label61.setBounds(45, 40, 60, 15);
p6.add(label61);
per++;
final JLabel label_162 = new JLabel();
label_162.setText("文件目录");
label_162.setBounds(45, 88, 60, 15);
p6.add(label_162);
final JLabel label_263 = new JLabel();
label_263.setText("文件名称");
label_263.setBounds(45, 351, 60, 15);
p6.add(label_263);
textField61 = new JTextField();
textField61.setEditable(false);
textField61.setBounds(111, 37, 342, 21);
p6.add(textField61);
// tree = new JTree();
JScrollPane tt1 = new JScrollPane(n_tree);
tt1.setBounds(111, 87, 342, 255);
p6.add(tt1);
textField_262 = new JTextField();
textField_262.setEditable(false);
textField_262.setBounds(111, 348, 342, 21);
p6.add(textField_262);
per++;
final JButton button61 = new JButton();
button61.setText("恢复");
button61.setBounds(340, 391, 99, 23);
p6.add(button61);
button61.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
Calculator wt = (Calculator) Naming
.lookup("rmi://localhost/CalculatorService");
wt.write(path1);
JOptionPane.showMessageDialog(null, "恢复数据库成功");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -