frank fera

Greenhorn
+ Follow
since Nov 03, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by frank fera

here's what I found, thanks goes to the kind person who responded with this solution (elsewhere)
...

As already noted: all scrollXXToVisible methods scroll such that the given XX is visible somewhere, they don't support finer control as f.i. "should be first node in visible area". You have to implement that functionality yourself, something like
TreePath path = tree.getSelectionPath();
if (path == null) return;
Rectangle bounds = tree.getPathBounds(path);
// set the height to the visible height to force the node to top
bounds.height = tree.getVisibleRect().height;
tree.scrollRectToVisible(bounds);

...
11 years ago
This is a simple question, with no visible solution. Is it a bug in java's scrollPathToVisible ???

If you are interested in scrolling your tree to a particular node, using scrollPathToVisible, it seems like common sense to me that you'd want that particular tree node at the top of the display.
What is the possible use case that would justify positioning such a tree node at the bottom of your display?

???

I'm going to investigate this further because I only just hit this problem, noticed this forum entry and was surprised that it didn't go further.
11 years ago