• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

help w/ game involving threads and drawImage

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about the double post :roll:
So I am trying to write an applet that will be interactive- a picture will momentarily flash on the screen at a random spot for some short amt of time and then disappear only to appear in a dif spot. The user has to click on the picture to win.
I know that I should use 2 threads (maybe more?)but when I put the drawImage method in the 2nd thread (class ShowImage extends Thread) the method does not want to display the image. Any help would be appreciated!
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,
Welcome to JavaRanch. You can delete the second post yourself by selecting the edit icon at the top. It's the one that looks like a pencil and paper. Don't delete this one though.
For your problem. Are you using swing or AWT?
 
Mike Frya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip! I am on a laptop
so I tend to press keys by accident as I type and
unintended things happen...
I am using AWT
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I deleted the double post before I read Mikes directions to Mike.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mike Frya:
Thanks for the tip! I am on a laptop
so I tend to press keys by accident as I type and
unintended things happen...
I am using AWT


Instead of playing twenty questions with you, it might be best for you to post some code and let us take a look at it. Use the CODE button and paste (or type ) your code between the tags. AWT isn't as picky as swing is about displaying graphics outside the main event thread but it is usually wise to handle all of it in one place if you can.
 
Mike Frya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here it is:
 
For my next trick, I'll need the help of a tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic