• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding one more thread

 
Jean Paul Martin
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,... i have this applet which runs a sort class .. however, now i wrote a different sort class and i want to add it into this applet so that when i open the page, i can see both running at the same time .. I know i should again use one more thread but how do i go about doing this? Let's say my other sort class is called quickSort.java! Thanks a lot. I appreciate
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can start the second one just like you started the first. Rename the variable from "sorter" to "insertionSorter" and make a new one for "quickSorter". Then just start one after the other:

Note I passed the sorter in to the animation thread so I could use the same AnimationThread class twice. Did that makes sense?
I'm curious how the animator displays sorter progress. Now your UI will have to display the progress of two sorts at the same time. It's a neat problem!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!