⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultsettablemodel.java.svn-base

📁 梦界家园程序开发基底框架
💻 SVN-BASE
字号:
package jm.framework.gui.module.jmtable.model ;

import java.sql.* ;

import javax.swing.table.* ;

/**
 * <p>Title: </p>
 *
 * <p>@author Spook</p>
 *
 * <p>@version 0.1.0</p>
 *
 * <p> </p> not attributable
 */
public class ResultSetTableModel
    extends AbstractTableModel
{
    /**
	 * 
	 */
	private static final long serialVersionUID = -8946847648967498095L;
	private ResultSet rs;
    private ResultSetMetaData rsmd;

    public ResultSetTableModel(ResultSet aResultSet)
    {
       rs = aResultSet;
       try
       {
          rsmd = rs.getMetaData();
       }
       catch(SQLException e)
       {
          e.printStackTrace();
       }
    }
    public String getColumnName(int column)
    {
       try
       {
          return rsmd.getColumnName(column + 1);
       }
       catch(SQLException e)
       {
          e.printStackTrace();
          return "";
       }
    }

    /**
       Gets the result set that this model exposes.
       @return the result set
    */
    protected ResultSet getResultSet()
    {
       return rs;
    }

    /**
     * Returns the number of columns in the model.
     *
     * @return the number of columns in the model
     * @todo Implement this javax.swing.table.TableModel method
     */
    public int getColumnCount ()
    {
        try
        {
           return rsmd.getColumnCount();
        }
        catch(SQLException e)
        {
           return 0;
        }
    }

    /**
     * Returns the number of rows in the model.
     *
     * @return the number of rows in the model
     * @todo Implement this javax.swing.table.TableModel method
     */
    public int getRowCount ()
    {
        try
        {
            return rs.getRow() ;
        }
        catch(SQLException e)
        {
           return 0;
        }
    }

    /**
     * Returns the value for the cell at <code>columnIndex</code> and
     * <code>rowIndex</code>.
     *
     * @param rowIndex the row whose value is to be queried
     * @param columnIndex the column whose value is to be queried
     * @return the value Object at the specified cell
     * @todo Implement this javax.swing.table.TableModel method
     */
    public Object getValueAt ( int rowIndex , int columnIndex )
    {
        return null ;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -