Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes JTable row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable row" Watch "JTable row" New topic
Author

JTable row

supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
hello

I am using JTable to display contents..when i am selecting any row is it possible to automatically scroll the contents so that user can read full contents..
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19359
    
  10

No, if there are more rows than can fit on the screen, clearly no amount of scrolling will make them all visible at the same time.

Or when you said "the contents" did you just mean the contents of the selected row, and not the contents of the table? Again, if there are more columns than can fit on the screen, clearly no amount of scrolling will make them all visible at the same time.
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
i mean to scroll contents of the selected row and selected column only say i have 2nd column in which i have one big line but on the screen it is not fully visible so when i am selecting that cell(row) is it possible to scroll it automatically?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10696
    
    9

Check out JTable#getCellRect() and JComponent#scrollRectToVisible().
Using these two you can achieve the desired effect.
I presume your column width is sufficient enough to display the big line.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JTable row