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
Joined: Jan 21, 2008
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.."
subject: AdjustmentListener on JScrollBar always returns event TRACK