This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to find visible row count in JTable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to find visible row count in JTable?" Watch "How to find visible row count in JTable?" New topic
Author

How to find visible row count in JTable?

Premal Panchal
Greenhorn

Joined: May 09, 2005
Posts: 6
Hi All,

I have one scroll pane in which i have set one table. Now my problem is to find visible row count in Scroll Pane area. I know that there is no direct function for that. But i tried to find Scroll Pane's height and all other relative functions, but by that way i got total height of Scroll Pane rather than visible area's height. Does anybody know how to find height of visible area of scroll pane? If I find that then I can get visible row count by dividing it to row height. Any help regarding this will apprieated.

Thanx and Regards,
Premal Panchal
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

JViewPort is the class which represents the visible portion of a ScrollPane.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Premal Panchal
Greenhorn

Joined: May 09, 2005
Posts: 6
Hi,

I tried JViewPort also. But it gives me total hight of ViewPort rather than the visible part of JScrollPane. So is there any other way to do this? I tried all functions related to JViewPort of JScrollPane,JTable. But I couldn't get the proper result.

Thanx and Regards,

PremalPanchal
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Drag the bottom of the JFrame to activate the ComponentListener.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to find visible row count in JTable?
 
Similar Threads
how to reach current JTextArea
JScrollPane, spacing and scrolling issues - HELP!
Collapsing JScrollPane?
calculating the first row visible height of a JTable
Printing hardcopy - multiple copies