• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding one more thread

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic