Solved

Make a tree node visible

Posted on 2001-09-04
3
586 Views
Last Modified: 2006-11-17
I have a JTree in a scroll pane.
I want that after every change selection (not only the mouse, but also using the keyboard), the selected node will be seen.
I've added a listener to catch the change selection events and in the event i call to scrollPathToVisible method.
It simply doesn't work.
Can you tell me why?
0
Comment
Question by:rzvika
  • 2
3 Comments
 
LVL 16

Expert Comment

by:heyhey_
Comment Utility
> It simply doesn't work.

post a small compilable example that reproduces the problem
0
 
LVL 16

Expert Comment

by:Valeri
Comment Utility
Hi Rzvika,

I have heard for it :
It's Swing bug, which is reported on Sun web site. There is workaround for it. Just call the function twice :

scrollTreePathToVisible(tree, path);
scrollTreePathToVisible(tree, path);

Best regards,
Valeri
0
 
LVL 16

Accepted Solution

by:
Valeri earned 50 total points
Comment Utility
Sorry, call the function twice :

tree.scrollPathToVisible(treePath);
tree.scrollPathToVisible(treePath);

You can use makeVisible(path) as well... What do you exactly want ?
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count7 challenge 12 66
countX 22 68
computer science syllabus 3 52
Securing Jmx Console and web console 2 45
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now