我想在表中显示数据库中的数据。我收到此错误“无法从静态上下文引用非静态变量 jtable1”。帮我解决这个错误
st.executeQuery("select * from course" );
ResultSet rs = st.getResultSet();
ResultSetMetaData md = rs.getMetaData();
int c_count = md.getColumnCount();
Vector data = new Vector(c_count);
Vector row = new Vector(c_count);
Vector colname = new Vector(c_count);
for(int i=0;i<c_count;i++)
{
colname.addElement(md.getColumnName(i));
}
while(rs.next())
{
for(int i=0;i<c_count;i++)
{
row.addElement(rs.getObject(i));
}
data.addElement(row);
row = new Vector(c_count);
}
DefaultTableModel model = new DefaultTableModel(data,colname);
jTable1.setModel(model);