Results 1 to 2 of 2
  1. #1
    ImNoTree is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default Image atop another image in GUI

    I'm currently creating a simple monopoly-game in Java for class. Since I need to show all of the streets, and sometimes players atop the streets, I need to use some component in the swing library which can accomplish this.

    I've tried JLabel and JLayeredPane but I haven't gotten any of these to work. Does anyone know what I should use.

    tl;dr: I want to put an image atop another image in a squared box(like a JLabel), how to accomplish?


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I would have the game square be a JPanel with a background image and the playing piece a JLabel that sits on the JPanel. If you want to be able to move the piece, then a JLayeredPane would work well. You can search this forum for examples of this including examples of chess board or checkers board. Otherwise, I'm not sure how to help you further when you say "it doesn't work" but don't provide details.

Similar Threads

  1. Replies: 1
    Last Post: 04-17-2009, 01:44 AM
  2. Replies: 14
    Last Post: 04-10-2009, 09:46 AM
  3. Canvas Image popups another image (SWT)
    By SpaceY in forum New To Java
    Replies: 2
    Last Post: 11-11-2008, 02:25 PM
  4. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 07:17 PM
  5. Replies: 0
    Last Post: 01-08-2008, 06:29 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