It's not clear why you would want to do this (you should really only deal with the data, not the implementation details of how the scroll bar is painted).
It would seem reasonable to assume the following relationships hold, though:
value / ( max - min ) = position / (width - visibleWidth)
visibleAmount / (max - min) = visibleWidth / width
where position, visibleWidth, and width are in graphical units (pixels), and min, max, value, and visibleAmount refer to the properties defined by ScrollBar.
Some simple algebra should give you the value in terms of quantities you either know or can query the scrollbar for.
thanks for the reply, it is a word processing program, like that of netbeans, extended the listview for it, and when to typing requires that the thumb is positioned correctly in relation to the cursor position within the component.
Doesn't just setting the scrollbar values directly work? I.e., for your example
scrollbar.setMin(0); scrollbar.setMax(100); scrollBar.setVisibleAmount(50); scrollbar.setValue(70);
ok, I will test your suggestion, thanks James_D.
listView inside a horizontal scrollBar is correct, but
Vertical in scrollBar not do it correctly.
I did the following test for scrollBar vertical
scrollbarVertical.setValue(70); <-- no set correct
internally work with values between 0 and 1 and after these settings the setValue no set correct thumb.
is a bug or lack some understanding of this implementation?