🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Move JScrollPane slider programmatically?

#9663
From: Fred H. Porter PE
Date: Fri, 11 Feb 2000 00:00
52 lines
2018 bytes
Thanks Ernesto,
If you refer to my original "How do I move the Thumb" you see how these
lines
fit in.  Your solution works well, and I have another one that finds the
current
length and prints the coordinates.

    scrollPane = new JScrollPane(results); //add JScrollPane to get a
slider
    AC.add(scrollPane); //add JScrollPane

    //use this to move the slider to the bottom
    scrollBar = scrollPane.getVerticalScrollBar();
    scrollBar.setValue(scrollBar.getMaximum());

    //or this, thanks Ernesto
    scrollPane.getViewport().setViewPosition(0,400);

    //print the result
    results.append("Location of Slider: " +
      scrollPane.getViewport().getViewPosition().toString() + "\n");

 Fred

Ernesto Bascon Pantoja wrote:

> Hi:
>
> Try:
>
> scrollPane.getViewport().setViewPosition(new Point(x, y));
>
> x and y are the coordinates of your document.
> This point will be showed at the top and left scrollpane position.
>
> Saludos
>
> Ernesto
>
> "Fred H. Porter PE" wrote:
> >
> > How can I move the slider (thumb) in a JScrollPane
> > programmatically rather than manually with the End Key?
> > Thanks,
> > Fred
>
> --
> --------------------------------------------------------
>                 Hand fits giving, so do it
>
> Polimorf's Page:     http://166.114.106.63
> --------------------------------------------------------
Technical Details
Message-ID: <38A4CAD0.6DB57D57@pdspp.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38A474E7.8D7D0B77@pdspp.com> <38A4981A.D2214EF0@ucbcba.edu.bo>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,6a578145d8b83ce6
X-Google-Attributes: gid111d45,public
From: "Fred H. Porter PE" <fredp@pdspp.com>
Subject: Re: Move JScrollPane slider programmatically?
Date: 2000/02/11
Message-ID: <38A4CAD0.6DB57D57@pdspp.com>
X-Deja-AN: 584819591
Content-Transfer-Encoding: 7bit
References: <38A474E7.8D7D0B77@pdspp.com> <38A4981A.D2214EF0@ucbcba.edu.bo>
To: bascone@ucbcba.edu.bo
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Porter Data Systems, Inc.
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing