Article View: borland.public.jbuilder.java.swing
Article #1811Re: JScrollPane
From: Sultanbek Tezadov
Date: Fri, 01 Aug 2003 06:44
Date: Fri, 01 Aug 2003 06:44
28 lines
1725 bytes
1725 bytes
Add to your class the following method:
private static void setScrollBarValue(final JScrollBar scrollBar,
final int value) {
EventQueue.invokeLater(new Runnable() {
public void run() { scrollBar.setValue(value); }
});
}
And call it when you want to scroll:
setScrollBarValue(jScrollPane1.getVerticalScrollBar(), 0);
--Sultan
On Thu, 31 Jul 2003 11:25:34 -0400, Nechama Shuchatowitz
<nshuch@teamgenesis.com> wrote:
> I have a file displayed in a JTextArea which is in a JScrollPane. When
> the
> window appears, the scroll bar is all the way down, displaying the end of
> the file. How can I set it to have the JScrollPane scrolled up to
> display
> the beginning of the file?
>
> _______
> Nechama Shuchatowitz
> nshuch@teamgenesis.com
Technical Details
Message-ID:
<oprs7rnqttf1uvdc@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f293546$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,d70192ae4b7b35cf X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-07-31 23:46:26 PST Newsgroups: borland.public.jbuilder.java.swing Subject: Re: JScrollPane References: <3f293546$1@newsgroups.borland.com> Message-ID: <oprs7rnqttf1uvdc@newsgroups.borland.com> Content-Type: text/plain; charset=koi8-r; format=flowed From: Sultanbek Tezadov <st99@mail.ru> Date: Fri, 01 Aug 2003 10:44:04 +0400 In-Reply-To: <3f293546$1@newsgroups.borland.com> User-Agent: Opera7.0/Win32 M2 build 2637 MIME-Version: 1.0 NNTP-Posting-Host: 62.231.6.23 X-Trace: newsgroups.borland.com 1059720243 62.231.6.23 (31 Jul 2003 23:44:03 -0700) Lines: 28 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail