problem with threads and graphics

I have a thread that chooses paths for a Travelling salesman problem, it then calls a TSPdraw class and passes it the path, which the class then draws. the problem is when i have two threads it creates two windows but only draws a path in one of them. any ideas where i`m going wrong
[297 byte] By [jonbyrne] at [2007-9-30 8:02:18]
# 1

Are you using swing components? Swing isn't threadsafe. If you have multiple threads that want to update your UI you need to use the SwingUtilities.invokeLater(...)or invokeAndWait(...). There is a page in the swing tutorial about this at: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

RadcliffePike at 2007-7-2 16:39:58 > top of Java-index,Administration Tools,Sun Connection...