Java Tips Weblog

  • Blog Stats

    • 2,189,673 hits
  • Categories

  • Archives

  • Advertisements

Jump Scrollbar Model

Posted by Darryl Burke on April 18, 2009

The default, and usually desired, behavior of a scrollbar is to continuously scroll its associated component while the scroll thumb is being dragged. There are at least two situations where this behavior may lead to a sluggish and unresponsive GUI:

  • A complicated custom renderer bogs down the processor
  • The contents to display are dynamically loaded from disk as the portions of the scrollable component are shown.

JumpScrollBarModel provides a behavior akin to clearing the option “Show window contents while dragging” on Windows. The scrollable component’s position will remain fixed while dragging the scroll thumb, and will update when the drag is terminated by releasing the mouse button. An optional setting allows for updating the scroll position when the mouse is paused for a user-defined interval.

A comprehensive set of constructors and overloads of the static utility method setJumpScrollBarModel make setting a JumpScrollBarModel a no-brainer. The simulation below shows the behavior of a JumpScrollBarModel set with the line

JumpScrollBarModel model =


JumpScrollBarModel extends DefaultBoundedRangeModel.

Get The Code

See Also

Jump Scrollbar Tooltip

Related Reading

Java API: javax.swing.DefaultBoundedRangeModel


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: