java课程设计----图书馆管理系统
private JButton btnCancel=new JButton("取消"); private JFrame f=null;
public BookEditor(JFrame f,String s,boolean b) {
LayoutUtil.add(p,GridBagConstraints.NONE,
GridBagConstraints.CENTER,0,0,0,1,1,1,labBookPrice); GridBagConstraints.CENTER,100,0,1,1,1,1,txtBookPrice); GridBagConstraints.CENTER,0,0,2,1,1,1,labBookPress); GridBagConstraints.CENTER,100,0,3,1,1,1,txtBookPress);
LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, LayoutUtil.add(p,GridBagConstraints.NONE, LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, //注册事件侦听器
btnOk.addActionListener(this); btnCancel.addActionListener(this); btnPre.addActionListener(this); btnNext.addActionListener(this);
btnOk.setIcon(new ImageIcon("image/ok20.gif"));
btnCancel.setIcon(new ImageIcon("image/cancel20.gif")); btnPre.setIcon(new ImageIcon("image/pre20.gif")); btnNext.setIcon(new ImageIcon("image/next20.gif")); btnNext.setHorizontalTextPosition(SwingConstants.LEFT); //在增加模式下前后移动按钮置为不可用
//读者扩展该程序具有编辑功能时,可以将前后移动按钮置为可用 if(s.equals("增加")){ }
btnPre.setEnabled(false); btnNext.setEnabled(false);
super(f,s,b); this.f=f;
//面板p中显示图书信息 JPanel p=new JPanel();
p.setLayout(new GridBagLayout());
LayoutUtil.add(p,GridBagConstraints.NONE,
GridBagConstraints.CENTER,0,0,0,0,1,1,labID); GridBagConstraints.CENTER,100,0,1,0,1,1,txtID); GridBagConstraints.CENTER,0,0,2,0,1,1,labBookName); GridBagConstraints.CENTER,100,0,3,0,1,1,txtBookName);
LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, LayoutUtil.add(p,GridBagConstraints.NONE, LayoutUtil.add(p,GridBagConstraints.HORIZONTAL,
//面板ap中显示4个按钮 JPanel ap=new JPanel();