🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.gui
Article #20

JTable scrolling on scroll pane

#20
From: Paul Wang
Date: Tue, 17 Oct 2000 00:00
17 lines
1601 bytes
I have a JTable on JScrollPane. When insert a new row to table model, I
want JScrollPane scroll to the bottom to show the newly inserted row.
But it can only scroll to the last row before insertion. Is there anyone
has experience with this kind situation. Thanks.
Paul Wang
pwang@teloptica.com

            // scroll to the bottom
            JScrollBar sb = tableScrollPane.getVerticalScrollBar();
            System.out.println("table row count: " +
table.getRowCount());  // debug
            if (table.getRowCount()*table.getRowHeight() >
(sb.getHeight()-sb.getLocation().getY()))
            {
              sb.setValue((table.getRowCount()+1)*table.getRowHeight());

            }
Technical Details
Message-ID: <39EC5FDB.956EB3EB@teloptica.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,54d3bae57a82f1a5,start
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 10fd6d,54d3bae57a82f1a5,start
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: fbe9c,54d3bae57a82f1a5,start
X-Google-Attributes: gidfbe9c,public
From: Paul Wang <pwang@teloptica.com>
Subject: JTable scrolling on scroll pane
Date: 2000/10/17
Message-ID: <39EC5FDB.956EB3EB@teloptica.com>
X-Deja-AN: 682473130
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@home.net
X-Trace: news1.rdc1.tx.home.com 971792279 209.219.147.29 (Tue, 17 Oct 2000 07:17:59 PDT)
Organization: @Work Internet powered by @Home Network
MIME-Version: 1.0
NNTP-Posting-Date: Tue, 17 Oct 2000 07:17:59 PDT
Newsgroups: comp.lang.java.gui,borland.public.jbuilder.java,comp.lang.java.help