该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
关于查询的页面
public class Search_tea1 extends JFrame implements ActionListener{
Button btn,btn2;
JTextField jt,jt2,jt3;
JTable jTable;
JScrollPane jScrollPane;
Object[][] teachers;
String[] names;
String a;
TeacherAction ab;
Integer b;
Search_tea1(){
setSize(600,600);
setTitle(new String("查询:"));
setLayout(new FlowLayout());
Container con=getContentPane();
names=null;
teachers=null;
jTable=new JTable(teachers,names);
jScrollPane = new JScrollPane(jTable);
jt=new JTextField(20);
Label lb=new Label("教师id:");
btn=new Button("确定");
btn.addActionListener(this);
btn2=new Button("取消");
btn2.addActionListener(this);
add(lb);add(jt);
add(btn);add(btn2);
add(jScrollPane);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
}
public void actionPerformed(ActionEvent e){
Container con=getContentPane();
if(e.getActionCommand().equals("确定")){
con.setBackground(Color.red);
String a=jt.getText();
a.trim();
Integer b=Integer.valueOf(a);
TeacherAction ab=new TeacherAction();
try {
ab.get(b);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String[] names={"教师id","教师姓名","教师性别","毕业院校","学历"};
try {
Object[][] teachers={{ab.get(b).gett_id(),ab.get(b).gett_name(),ab.get(b).gett_sex(),ab.get(b).gett_school(),ab.get(b).gett_education()}};
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JOptionPane.showMessageDialog(null,"信息查询成功!","信息",JOptionPane.INFORMATION_MESSAGE );
}
if(e.getActionCommand().equals("取消")){
dispose(); //关闭当前页面
}
}}