aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes AdjustmentListener on JScrollBar always returns event TRACK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "AdjustmentListener on JScrollBar always returns event TRACK" Watch "AdjustmentListener on JScrollBar always returns event TRACK" New topic
Author

AdjustmentListener on JScrollBar always returns event TRACK

Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
I have a dead simple test program that creates a JScrollbar, adds an AdjustmentListener and prints out the event types as they occur. From what I read in the api, I was expecting to see different events in the console when I clicked on an arrow vs clicking on the track. But the console always displays AdjustmentEvent.TRACK ie 5. Am I missing something simple?

Corrie L Sherone
Greenhorn

Joined: Jan 21, 2008
Posts: 19
Doh, I was reading the wrong section of the docs. Seems the behavior is a bug, or by design, depending on how you look at it. Not the answer I wanted, but at least now I know.

Bug 4075484 "When user scroll ScrollPane, we receive notifications in native code. Then we propogate these notifications to Java code by issuing PeerEvent which calls setValue() ... The problem is that there is no way to pass scroll-type to setValue()"

JScrollBar "Note that the AdjustmentEvents type property will always have a placeholder value of AdjustmentEvent.TRACK because all changes to a BoundedRangeModels value are considered equivalent.."
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: AdjustmentListener on JScrollBar always returns event TRACK