I’m trying to, while the animated auto-layout process happens, the user
could stop the animation, or do something else with the application
instead of waiting for the long animation routine (± 300 nodes and links
in a Force Directed layout).
I’ve tried to put the autolayout class in a low priority thread. I’ve tried to
yield the thread while the layoutnodesandlinks run, but with no success.
Any ideas ?
Thanks in advance,
Did you try to stop() the Thread that called performLayout()?
I’m still a newbie to all this and confess that I’m a little lost here.
I wasn’t thinking about using threads util I find this need to stop the
animation of a big layout process. The user wouldn’t want to wait so long
to even close the application. The way it is, appears that the app has
So, talking about threads, I’ve read so much on the internet and my mind
is beggining to fail.
The thing is: there is a method renderTree() that iterates through the data
structure, drawing nodes on JGoView and inside this method I call the
myLayout animated, every node I draw.
This loop takes all the cpu, and the user cannot stop the process.
So I’ve tried two things:
1. made the myLayout class runnable, and after thread(mylayout)… and
put some Thread.sleep and yield inside the layoutnodesandlinks…
2. made the MyView class runnable and call thread(MyView)… This is the
class that calls the renderTree method.
Even when I put a long period to Thread.sleep(1000), the user cannot
stop the process or do anything else.
I’m completely lost and could use some help… Does anybody has already
tried to accomplish this task ?
Many thanks in advance,
Ok. I’ve made some progress…
I’ve created a class that do the renderTree job. So, I put it in a Thread and
the user can move the mouse around and click everywhere…
Now I only have to stop the thread. This could be really more than