Jscrollpane; update scrollbars

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gangreen
    New Member
    • Feb 2008
    • 98

    Jscrollpane; update scrollbars

    I have a Jscrollpane, holding a Jpanel on which I draw. Now, I have made buttons to zoom in and out. They will simply change the value of variables that hold the size of my Jpanel and the drawing on my Jpanel, and then resize the panel and redraw.

    When I zoom in, the scrollbars don't update itself, unless I grab a border of my Jframe, and resize the window. How do I get the scrollbars of the Jscrollpane to update?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    a JScollPane has a JViewPort component which has your JPanel as its (single)
    member component. When you change your component you have to tell your
    JViewPort about that event. (JViewPort.setV iew(Component c)). The change will
    propagate all the way up to the JScrollPane and the scroll bars will be updated.

    kind regards,

    Jos

    Comment

    • Gangreen
      New Member
      • Feb 2008
      • 98

      #3
      Thanks! Exactly what I needed.

      Comment

      Working...