I have a problem with threading involving two animations...
I am creating a simple starwars-style space shooter in java. I have my starfield,
which I wrote. Also, I have a spaceship image. I want to have the starfield
loop run on one thread and the image controlled by key events on another
thread. The problem is that I can't get any Graphics to work with the run()
so for instance, if I have a thread called Sfield, i want to run the Sfield
graphic animation in one thread, i tried the following..
SpaceWar thread1 = new SpaceWar();
Thread war = new Thread(thread1);
//Thats my thread initialization for one thread.
then in the run method...
public void run(Graphics g)
I get an error beacause I can't use the graphics g object in this method!
How would I use the g.drawImage line in a seperate thread?
Thanks in advance, Roland.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center