public Object getValueAt(int row, int column) { }
return ((Vector)this.rowData.get(row)).get(column);
@Override }
36 / 50
public String getColumnName(int arg0) { }
return (String) this.columnNames.get(arg0);
查询模块程序设计: //chaxun.java package com.test; import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.*; import java.awt.*; import java.awt.event.*;
public class Chaxun extends JFrame implements ActionListener{
JPanel jp1; JLabel jl1;
JButton jb1,jb2,jb3,jb4; JTable jt;
JScrollPane jsp;
37 / 50
JTextField jtf;
Chazhao cz=new Chazhao(); public static void main(String[] args) { }
public Chaxun() {
jp1=new JPanel(); Chaxun test=new Chaxun();
jtf=new JTextField(10);
jb1=new JButton(\查询\ jb1.addActionListener(this);
jl1=new JLabel(\请输入学号\ jp1.add(jl1); jp1.add(jtf); jp1.add(jb1);
jt=new JTable(cz);
jsp=new JScrollPane(jt);
this.add(jsp); this.add(jp1,\
38 / 50
this.setSize(400,300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true);
}
public void actionPerformed(ActionEvent arg0){
if(arg0.getSource()==jb1){ System.out.println(\用户查询\ String name=this.jtf.getText().trim();
String sql=\* from 成绩表number='\ Chazhao cz=new Chazhao(sql); jt.setModel(cz);
}
}
}
39 / 50
where
添加模块程序设计 //tianjia.java package com.test;
import java.awt.*; import java.awt.event.*; import java.sql.*;
import javax.swing.JDialog; import javax.swing.JOptionPane;
public class Tianjia extends JDialog implements ActionListener {
int k,s1,j;
Connection con; Button charu;
TextField input1,input2,input3,input4,input5,input6; TextArea show;
Statement sql; int sum=0; ResultSet rs;
Tianjia(){
40 / 50