Article View: borland.public.jbuilder.java.swing
Article #1813Re: JScrollPane
From: Nechama Shuchatowitz
Date: Fri, 01 Aug 2003 14:04
Date: Fri, 01 Aug 2003 14:04
44 lines
2160 bytes
2160 bytes
Actually, I found a simpler way to do it that works well:
textArea.setCaretPosition(0);
Thanks for your help, though!
_______
Nechama Shuchatowitz
nshuch@teamgenesis.com
"Sultanbek Tezadov" <st99@mail.ru> wrote in message
news:oprs7rnqttf1uvdc@newsgroups.borland.com...
> 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:
<3f2a7427$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f293546$1@newsgroups.borland.com> <oprs7rnqttf1uvdc@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-08-01 07:12:02 PST From: "Nechama Shuchatowitz" <nshuch@teamgenesis.com> Newsgroups: borland.public.jbuilder.java.swing References: <3f293546$1@newsgroups.borland.com> <oprs7rnqttf1uvdc@newsgroups.borland.com> Subject: Re: JScrollPane Date: Fri, 1 Aug 2003 10:04:07 -0400 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 69.3.86.78 Message-ID: <3f2a7427$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059746855 69.3.86.78 (1 Aug 2003 07:07:35 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail