java课程设计----图书馆管理系统
private JRadioButton radBookPress=new JRadioButton(" 出 版 社 "); private JTextField txtBookPress=new JTextField(); private JButton btnOk=new JButton("确定(Yes)"); private JButton btnCancel=new JButton("取消(Esc)"); public SearchDialog(JFrame f,String s,boolean b){
super(f,s,b); this.f=f;
ButtonGroup group=new ButtonGroup(); group.add(radID); group.add(radBookName); group.add(radBookPress); txtID.setEditable(false); radBookName.setSelected(true); txtBookPress.setEditable(false); radID.addActionListener(this); radBookName.addActionListener(this); radBookPress.addActionListener(this); //面板p中显示查询条件 JPanel p=new JPanel();
p.setLayout(new GridBagLayout());
LayoutUtil.add(p,GridBagConstraints.NONE,
GridBagConstraints.CENTER,0,0,0,0,1,1,radID); GridBagConstraints.CENTER,100,0,1,0,1,1,txtID); GridBagConstraints.WEST,0,0,0,1,1,1,radBookName); GridBagConstraints.CENTER,100,0,1,1,1,1,txtBookName); GridBagConstraints.CENTER,0,0,0,2,1,1,radBookPress); GridBagConstraints.CENTER,100,0,1,2,1,1,txtBookPress);
LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, LayoutUtil.add(p,GridBagConstraints.NONE, LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, LayoutUtil.add(p,GridBagConstraints.NONE, LayoutUtil.add(p,GridBagConstraints.HORIZONTAL, btnOk.setIcon(new ImageIcon("image/ok20.gif"));
btnCancel.setIcon(new ImageIcon("image/cancel20.gif")); btnOk.addActionListener(this); btnCancel.addActionListener(this); //面板ap中显示确定 取消按钮 JPanel ap=new JPanel(); ap.add(btnOk); ap.add(btnCancel);
getContentPane().add(p,BorderLayout.CENTER); getContentPane().add(ap,BorderLayout.SOUTH);
private JFrame f=null;