Java JTable Row Visible computeVisibleRowsCount(JTable table)

Here you can find the source of computeVisibleRowsCount(JTable table)

Description

Returns the number of visible rows in the given table.

License

Open Source License

Declaration

public static double computeVisibleRowsCount(JTable table) 

Method Source Code

//package com.java2s;
/********************************************************************************
 * The contents of this file are subject to the GNU General Public License      *
 * (GPL) Version 2 or later (the "License"); you may not use this file except   *
 * in compliance with the License. You may obtain a copy of the License at      *
 * http://www.gnu.org/copyleft/gpl.html                                         *
 *                                                                              *
 * Software distributed under the License is distributed on an "AS IS" basis,   *
 * without warranty of any kind, either expressed or implied. See the License   *
 * for the specific language governing rights and limitations under the         *
 * License.                                                                     *
 *                                                                              *
 * This file was originally developed as part of the software suite that        *
 * supports the book "The Elements of Computing Systems" by Nisan and Schocken, *
 * MIT Press 2005. If you modify the contents of this file, please document and *
 * mark your changes clearly, for the benefit of others.                        *
 ********************************************************************************/

import javax.swing.*;

public class Main {
    /**/*  w  w  w .j a v  a  2  s. c  o  m*/
     * Returns the number of visible rows in the given table.
     */
    public static double computeVisibleRowsCount(JTable table) {
        return table.getParent().getBounds().getHeight()
                / table.getRowHeight();
    }
}

Related

  1. ensureRowVisible(JTable table, int row)
  2. ensureRowVisible(JTable table, int row)
  3. getFirstVisibleRow(JTable p_Table)
  4. getFirstVisibleRowIndex(JTable table)