Programmtically Scrolling a Scrollpane

From: Aaron Davies (aaron.davies_at_knox.army.mil.invalid)
Date: 07/27/04


Date: Tue, 27 Jul 2004 20:33:15 GMT

Hi, I'm writing a graphics program, and I'm currently implementing a
zoom function. The graphics are drawn on a JPanel wrapped in a
JScrollPane, and while my zoom is working fine as far as scaling the
graphics, I'm having a lot of trouble figuring out how to scroll the
scrollpane. After zooming, I would like to scroll the pane so that the
point clicked is in the center, so as to follow the "zoom in"
conventions in other graphics progs. (At the moment, the pane is always
scrolled top-left after a zoom.) I've tried invoking scrollRectToVisible
to on the pane's viewport, but it doesn't seem to work. I've also tried
using the setValue methods on the pane's scrollbars, but that doesn't do
anything either. Does anyone have any ideas?



Relevant Pages

  • Programmtically Scrolling a Scrollpane
    ... Hi, I'm writing a graphics program, and I'm currently implementing a ... and while my zoom is working fine as far as scaling the ... I would like to scroll the pane so that the ...
    (comp.lang.java.gui)
  • Re: Programmtically Scrolling a Scrollpane
    ... > zoom function. ... The graphics are drawn on a JPanel wrapped in a ... I would like to scroll the pane so that the ...
    (comp.lang.java.help)
  • Re: Programmtically Scrolling a Scrollpane
    ... > zoom function. ... The graphics are drawn on a JPanel wrapped in a ... I would like to scroll the pane so that the ...
    (comp.lang.java.gui)
  • Re: Programmtically Scrolling a Scrollpane
    ... > zoom function. ... The graphics are drawn on a JPanel wrapped in a ... I would like to scroll the pane so that the ... http://reader.imagero.com Java image reader ...
    (comp.lang.java.gui)
  • Re: Programmtically Scrolling a Scrollpane
    ... > zoom function. ... The graphics are drawn on a JPanel wrapped in a ... I would like to scroll the pane so that the ... http://reader.imagero.com Java image reader ...
    (comp.lang.java.help)

Loading