问题描述
Button1.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){ca.first(j2);ca.next(j2);Jdbcjd=newJdbc();Stringsql="select*fromUser2";ResultSetrs=jd.Jdbc1(sql);try{rs.beforeFirst();String[]s={"usename","password","姓名","性别","mail","tel"};String[][]str1=newString[50][6];for(inti=0;rs.next();i++){str1[i][0]=rs.getString("usename");//System.out.println(str1[i][0]);str1[i][1]=rs.getString("password");str1[i][2]=rs.getString("姓名");str1[i][3]=rs.getString("性别");str1[i][4]=rs.getString("mail");str1[i][5]=rs.getString("tel");}JTablejt=newJTable(str1,s);jt.setVisible(true);j4.add(jt);}catch(SQLExceptione1){e1.printStackTrace();}}});为什么我的JTable上只显示数据内容,没有表头usename","password","姓名","性别","mail","tel??
时间: 2024-09-12 00:56:53