关于Jtable的问题 表格的数据,我鼠标选种一行,将这行的数据取出来。应该怎么做,要实现什么监听的接口请大家帮忙? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.IOException;import java.sql.ResultSet;import java.sql.ResultSetMetaData;import java.sql.SQLException;public class MySqlUtil { public static String printMetaData(ResultSet rs) throws SQLException { ResultSetMetaData md=rs.getMetaData(); int colCount=md.getColumnCount(); String colLabel[] =new String[colCount+1]; int colDisplaySize[]=new int[colCount+1]; String colTypeName[]=new String[colCount+1]; System.out.println("database colCount="+colCount); StringBuffer sb = new StringBuffer(); for(int i=0;i<=colCount;i++) { colLabel[i]=md.getColumnName(i); colDisplaySize[i]=md.getColumnDisplaySize(i); colTypeName[i]=md.getColumnTypeName(i); sb.append("Label:"+colLabel[i]+ " " + "DisplaySize:" + colDisplaySize[i]+" "+ "TypeName:" + colTypeName[i]+"\r\n" ); } return sb.toString(); } public static String printResultSet(ResultSet rs) throws IOException, SQLException { ResultSetMetaData md=rs.getMetaData(); int colCount=md.getColumnCount(); String colLabel[] =new String[colCount+1]; for(int i=0;i<=colCount;i++) colLabel[i]=md.getColumnLabel(i); StringBuffer sb= new StringBuffer(); while(rs.next()) { for(int i=1; i<=colCount;i++) sb.append(colLabel[i]+ ":" + rs.getObject(i)+ " "); sb.append("\r\n"); } return sb.toString(); }}这个是方法,你根据这个方法写在你的table里面,加mouseListener调用 http://www.finereport.com 纯java电子表格 java笔试题,急急急急!!!! java socket传文件丢失数据??? 请教大家JAVA中接口的实现原理? installanywhere做已有安装程序的升级包 一个简单的问题。急!!! 多个继承共享生成一个链表,怎么做?(快快快快,在线等待) 有没有得到file的绝对路径却不包含文件名的方法? java调用系统命令传参数问题 想下载jdk1.3的源代码,但是sun说中国不是授权国家,不能下载,谁能帮帮我? 请教Visual cafe 高手,如何解决visual cafe 编程中汉字显示乱码问题 eventusermodel 操作EXCEL问题 请教
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class MySqlUtil { public static String printMetaData(ResultSet rs) throws SQLException
{
ResultSetMetaData md=rs.getMetaData();
int colCount=md.getColumnCount();
String colLabel[] =new String[colCount+1];
int colDisplaySize[]=new int[colCount+1];
String colTypeName[]=new String[colCount+1];
System.out.println("database colCount="+colCount);
StringBuffer sb = new StringBuffer();
for(int i=0;i<=colCount;i++)
{
colLabel[i]=md.getColumnName(i);
colDisplaySize[i]=md.getColumnDisplaySize(i);
colTypeName[i]=md.getColumnTypeName(i);
sb.append("Label:"+colLabel[i]+ " " +
"DisplaySize:" + colDisplaySize[i]+" "+
"TypeName:" + colTypeName[i]+"\r\n"
);
}
return sb.toString();
}
public static String printResultSet(ResultSet rs) throws IOException, SQLException
{
ResultSetMetaData md=rs.getMetaData();
int colCount=md.getColumnCount();
String colLabel[] =new String[colCount+1];
for(int i=0;i<=colCount;i++)
colLabel[i]=md.getColumnLabel(i);
StringBuffer sb= new StringBuffer();
while(rs.next())
{
for(int i=1; i<=colCount;i++)
sb.append(colLabel[i]+ ":" + rs.getObject(i)+ " ");
sb.append("\r\n");
}
return sb.toString();
}
}这个是方法,你根据这个方法写在你的table里面,加mouseListener调用