🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #7643

Re: JTable scrolling related question

#7643
From: John McGrath TeamB
Date: Thu, 11 Jan 2001 04:35
34 lines
2098 bytes
On Wed, 10 Jan 2001 14:41:34 +0100, Hartmut wrote:

> I need the same feature, but have a different problem: if
> I call that from the Action Listener of a button, it works.
> But it doesn't work at the end of another action that fills
> the table from a file and then immediately wants to scroll
> to the last row.

I presume that the problem is that the TableModel has the new rows in 
it, and while it has told the JTable about it, the JTable does not 
actually resize itself until it is time to paint itself.

My first thought was to defer the scrollRectToVisible() call, but if 
you do that using SwingUtilities.invokeLater(), I think it will get 
pushed ahead of the paint() events.

You could try doing a paintImmediately() on the JTable, and then doing 
the scroll.  I suspect that will work, but it may cause undesirable 
visual effects.

Another thing to try would be to set the JTable's size to it's 
preferred size before doing the scroll.

These are just some ideas off of the top of my head -- I don't know if 
they will work.  Please let us know if you find a solution.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.14c70100271fd34c989e6f@forums.borland.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
References: <3A1583E1.8FD78A76@netrisk.com> <3a15c300_2@dnews> <3a5c6686_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1fc5e943f0feb2d4
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2001-01-10 20:36:07 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: JTable scrolling related question
Date: Wed, 10 Jan 2001 23:35:56 -0500
Organization: Another Netscape Collabra Server User
Lines: 34
Message-ID: <MPG.14c70100271fd34c989e6f@forums.borland.com>
References: <3A1583E1.8FD78A76@netrisk.com> <3a15c300_2@dnews> <3a5c6686_2@dnews>
NNTP-Posting-Host: dslcv1-60.fast.net
X-Newsreader: MicroPlanet Gravity v2.30