java中JComboBox中的数据如何从数据库中取得 20
JLabellab1=newJLabel("科目");JLabellab2=newJLabel("年级");JLabellab3=newJLabel("班级");JLab...
JLabel lab1=new JLabel("科目");
JLabel lab2=new JLabel("年级");
JLabel lab3=new JLabel("班级");
JLabel lab4=new JLabel("查询");
JButton btn=new JButton("确定");
JButton btn2=new JButton("重置");
JComboBox c1=new JComboBox();
c1.addItem("语文");
c1.addItem("数学");
final JComboBox c2=new JComboBox();
c2.addItem("");
c2.addItem("一年级");
c2.addItem("二年级");
c2.addItem("三年级");
final JComboBox c3=new JComboBox();
c3.addItem("");
c3.addItem("一班");
c3.addItem("二班");
c3.addItem("三班");
final JComboBox c4=new JComboBox();
c4.addItem("");
c4.addItem("平均分");
c4.addItem("总分");
c4.addItem("不及格名单");就是怎么使科目,年纪,班级从数据库的科目,年纪,班级表取值 展开
JLabel lab2=new JLabel("年级");
JLabel lab3=new JLabel("班级");
JLabel lab4=new JLabel("查询");
JButton btn=new JButton("确定");
JButton btn2=new JButton("重置");
JComboBox c1=new JComboBox();
c1.addItem("语文");
c1.addItem("数学");
final JComboBox c2=new JComboBox();
c2.addItem("");
c2.addItem("一年级");
c2.addItem("二年级");
c2.addItem("三年级");
final JComboBox c3=new JComboBox();
c3.addItem("");
c3.addItem("一班");
c3.addItem("二班");
c3.addItem("三班");
final JComboBox c4=new JComboBox();
c4.addItem("");
c4.addItem("平均分");
c4.addItem("总分");
c4.addItem("不及格名单");就是怎么使科目,年纪,班级从数据库的科目,年纪,班级表取值 展开
展开全部
查询出来就是了:比如:
Student bean=new Student();
StudentDAO sdao=new StudentDAO();
List<Student> slist=(List<Student>)sdao.selectStudent(bean);//查询学生的方法
if(slist.size()>0)
{
for(int i=0;i<slist.size();i++)
{
Student student=(Student)slist.get(i);
c1.addItem(student.getKemu());
c2.addItem(student.getNianji());
c3.addItem(student.getBanji());
c4.addItem(sutdent.getFenshu());
}
}
//这样就行了,上面都是现打的,那些java bean,字段,方法应该能看明白吧。
Student bean=new Student();
StudentDAO sdao=new StudentDAO();
List<Student> slist=(List<Student>)sdao.selectStudent(bean);//查询学生的方法
if(slist.size()>0)
{
for(int i=0;i<slist.size();i++)
{
Student student=(Student)slist.get(i);
c1.addItem(student.getKemu());
c2.addItem(student.getNianji());
c3.addItem(student.getBanji());
c4.addItem(sutdent.getFenshu());
}
}
//这样就行了,上面都是现打的,那些java bean,字段,方法应该能看明白吧。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询