Results 1 to 2 of 2
  1. #1
    IHateNetbeans is offline Member
    Join Date
    Mar 2009
    Location
    Cheshire
    Posts
    6
    Rep Power
    0

    Default Image appear at random co-ord within jpanel

    'm doing a Java Project, based on a shooting gallery type game. I am in need of a bit of help on how an image at random within co-ordinates specified in the panel? I presume this would be easier with the use of threads, but i'm stuck on how to implement this.

    The game will use 3 different images, which will each have a different score value when clicked, so they must be treated individually. If anybody could help, or understands what I'm after that would be great?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You'll likely want to do your drawing inside of the JPanel's paintComponent(Graphics g) method, and most likely instead of separate threads, use a Swing Timer object to do any animation. If you search this forum, the Sun Java forum on these terms, you'll likely get hits on example code, some of it even good.

    Much luck.

Similar Threads

  1. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  2. How to display image from byte array in JPANEL
    By waqasdaar in forum AWT / Swing
    Replies: 0
    Last Post: 03-22-2009, 01:11 AM
  3. how to set image to a jpanel
    By masa in forum AWT / Swing
    Replies: 1
    Last Post: 03-02-2009, 09:36 AM
  4. Replies: 5
    Last Post: 11-02-2008, 07:41 AM
  5. Random Image on Refresh (FROM Folder not set number)
    By QuinnMal in forum Java Servlet
    Replies: 1
    Last Post: 07-06-2007, 08:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •