📄 systemmanagewindow.java
字号:
deck.add("c4",c4);
JPanel c5=new JPanel();
c5.setLayout(new BorderLayout());
JPanel g15=new JPanel();
g15.setLayout(new GridLayout(5,1));
JPanel g11=new JPanel();
g11.setLayout(new FlowLayout());
JLabel l111=new JLabel("管理员识别号");
t21=new JTextField(29);
g11.add(l111);
g11.add(t21);
g15.add(g11);
JPanel g12=new JPanel();
g12.setLayout(new FlowLayout());
JLabel l121=new JLabel(" 管理员帐号");
t22=new JTextField(29);
g12.add(l121);
g12.add(t22);
g15.add(g12);
JPanel g13=new JPanel();
g13.setLayout(new FlowLayout());
JLabel l131=new JLabel(" 管理员密码");
t23=new JPasswordField(16);
g13.add(l131);
g13.add(t23);
g15.add(g13);
JPanel g16=new JPanel();
g16.setLayout(new FlowLayout());
JLabel l161=new JLabel(" 确认密码");
t25=new JPasswordField(16);
g16.add(l161);
g16.add(t25);
g15.add(g16);
JPanel g14=new JPanel();
g14.setLayout(new FlowLayout());
JLabel l141=new JLabel(" 管理员权限");
t24=new JTextField(29);
g14.add(l141);
g14.add(t24);
g15.add(g14);
c5.add(g15,BorderLayout.CENTER);
JPanel nn=new JPanel();
nn.setLayout(new BoxLayout(nn,BoxLayout.Y_AXIS));
JButton n111=new JButton("上移");
n111.addActionListener(this);
nn.add(n111);
JButton n121=new JButton("下移");
n121.addActionListener(this);
nn.add(n121);
JButton n131=new JButton("添加");
n131.addActionListener(this);
nn.add(n131);
JButton n141=new JButton("删除");
n141.addActionListener(this);
nn.add(n141);
JButton n151=new JButton("修改");
n151.addActionListener(this);
nn.add(n151);
c5.add(nn,BorderLayout.EAST);
deck.add("c5",c5);
JPanel c7=new JPanel();
c7.setLayout(new BorderLayout());
JPanel password=new JPanel();
password.setLayout(new GridLayout(4,1));
JPanel managernumber=new JPanel();
managernumber.setLayout(new FlowLayout());
JLabel mn1=new JLabel("操作员帐号");
mn2=new JTextField(29);
managernumber.add(mn1);
managernumber.add(mn2);
password.add(managernumber);
JPanel oldpassword=new JPanel();
oldpassword.setLayout(new FlowLayout());
JLabel op1=new JLabel(" 原口令");
op2=new JPasswordField(16);
oldpassword.add(op1);
oldpassword.add(op2);
password.add(oldpassword);
JPanel newpassword=new JPanel();
newpassword.setLayout(new FlowLayout());
JLabel np1=new JLabel(" 新口令");
np2=new JPasswordField(16);
newpassword.add(np1);
newpassword.add(np2);
password.add(newpassword);
JPanel assurenewpassword=new JPanel();
assurenewpassword.setLayout(new FlowLayout());
JLabel anp1=new JLabel("确认新口令");
anp2=new JPasswordField(16);
assurenewpassword.add(anp1);
assurenewpassword.add(anp2);
password.add(assurenewpassword);
c7.add(password,BorderLayout.NORTH);
JPanel password1=new JPanel();
password1.setLayout(new FlowLayout());
JButton password2=new JButton("更改");
password2.addActionListener(this);
password1.add(password2);
c7.add(password1,BorderLayout.CENTER);
deck.add("c7",c7);
x.add(deck,BorderLayout.CENTER);
JPanel y=new JPanel();
y.setLayout(new GridLayout(11,1));
JButton b1=new JButton("图书库操作");
b1.addActionListener(this);
y.add(b1);
JButton b2=new JButton("读者库操作");
b2.addActionListener(this);
y.add(b2);
JButton b8=new JButton("管理员操作");
b8.addActionListener(this);
y.add(b8);
JButton b3=new JButton("数据统计");
b3.addActionListener(this);
y.add(b3);
JButton b4=new JButton("系统设置");
b4.addActionListener(this);
y.add(b4);
JButton b5=new JButton("数据备份");
b5.addActionListener(this);
y.add(b5);
JButton b6=new JButton("数据恢复");
b6.addActionListener(this);
y.add(b6);
JButton b7=new JButton("口令更改");
b7.addActionListener(this);
y.add(b7);
JButton b11=new JButton("锁定屏幕");
b11.addActionListener(this);
y.add(b11);
JButton b9=new JButton("返回主界面");
b9.addActionListener(this);
y.add(b9);
JButton b0=new JButton("退出程序");
b0.addActionListener(this);
y.add(b0);
x.add(y,BorderLayout.WEST);
dealer.first(deck);
frame.setSize(500,300);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.setTitle("图书管理系统");
frame.setModal(true);
Container x1=frame.getContentPane();
x1.setLayout(new BorderLayout());
JLabel z11=new JLabel("操作员号码");
JLabel z21=new JLabel("操作员口令");
t111=new JTextField(29);
t211=new JPasswordField(16);
JPanel m11=new JPanel();
m11.setLayout(new FlowLayout());
m11.add(z11);
m11.add(t111);
m11.setBorder(new EmptyBorder(100,0,0,0));
x1.add(m11,BorderLayout.NORTH);
JPanel m21=new JPanel();
m21.setLayout(new FlowLayout());
m21.add(z21);
m21.add(t211);
m21.setBorder(new EmptyBorder(0,0,0,0));
JPanel y1=new JPanel();
x1.add(m21,BorderLayout.CENTER);
y1.setLayout(new FlowLayout());
JButton b111=new JButton("确定");
if(s.equals("图书流通"))
{
b111.setActionCommand("1");
}
else if(s.equals("系统操作"))
{
b111.setActionCommand("2");
}
b111.addActionListener(this);
y1.add(b111);
x1.add(y1,BorderLayout.SOUTH);
}
public void copyFile(String oldPath, String newPath) throws java.io.FileNotFoundException,Exception {
// try {
int byteread = 0;
File oldfile = new File(oldPath);
File newfile = new File(newPath);
if (oldfile.exists()) { //文件存在时
InputStream inStream = new FileInputStream(oldfile); //读入原文件
FileOutputStream fs = new FileOutputStream(newfile);
byte[] buffer = new byte[1444];
while ( (byteread = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteread);
}
inStream.close();
fs.close();
}
/* }
catch (java.io.FileNotFoundException e1) {
JOptionPane.showMessageDialog(null, "复制文件操作出错,或许路径选择为光驱或移动设备且设备未就绪");
e1.printStackTrace();
return;
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "复制文件操作出错");
e.printStackTrace();
return;
} */
}
class SimpleFileFilter extends javax.swing.filechooser.FileFilter
{
String[] extentions;
String description;
public SimpleFileFilter(String[] exe,String descr)
{
extentions = new String[exe.length];
for(int i = exe.length-1;i>=0;i--)
{extentions[i] = exe[i].toLowerCase();}
description = (descr == null ? exe[0]+"files" : descr);
}
//////////////////////////////////有改动 添了[i]
public boolean accept(File f)
{
if(f.isDirectory())
{
return true;
}
String name = f.getName().toLowerCase();
for(int i = extentions.length-1;i>=0;i--)
{
if(name.endsWith(extentions[i]))
{
return true;
}
}
return false;
}
public String getDescription()
{
return description;
}
}
public void actionPerformed(ActionEvent e){
if(e.getActionCommand().equals("图书库操作"))
{
dealer.show(deck,"c1");
bank="book";
}
else if(e.getActionCommand().equals("读者库操作"))
{
dealer.show(deck,"c2");
bank="reader";
}
else if(e.getActionCommand().equals("数据统计"))
{
int count=0;
DataBase_Sever d=new DataBase_Sever();
d.select("book", "");
try{
while(d.rs.next()){
count++;
}
d.rs.close();
}catch(SQLException ex1){}
d.closeDB();
bt2.setText(Integer.toString(count));
int count2=0;
d.select("reader", "");
try{
while(d.rs.next()){
count2++;
}
d.rs.close();
}catch(SQLException ex1){}
d.closeDB();
bt4.setText(Integer.toString(count2));
int count4=0;
d.select("book", "where BookStatus='在库'");
try{
while(d.rs.next()){
count4++;
}
d.rs.close();
}catch(SQLException ex1){}
d.closeDB();
bt6.setText(Integer.toString(count4));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -