Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Is it possible to stack one ImageIcon on another?

  1. #1
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Is it possible to stack one ImageIcon on another?

    I'm working on a project where it may be necessary to add one ImageIcon on top of another. For example, like stacking a player sprite over top of a background tile?

    Is this even possible? If so, could I have a hint as to how to proceed?
    and if not, where could I start as far as a workaround?

    Cheers!
    ~Alt

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

    Default Re: Is it possible to stack one ImageIcon on another?

    You can't display naked ImageIcons regardless if you wanted to stack them. You *can* display them in JLabels, and you can stack JLabels, for instance if you used a JLayeredPane. Or you could use BufferedImages and draw them in a stacking fashion in a JPanel's paintComponent(...) method. You can Google sample code for both of these guys if you're interested.

  3. #3
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Is it possible to stack one ImageIcon on another?

    Alright, I'll give that a try, then. Thanks!

    ~Alt

  4. #4
    pbrockway is offline Member
    Join Date
    Dec 2011
    Posts
    1
    Rep Power
    0

    Default Re: Is it possible to stack one ImageIcon on another?

    With a bit of luck Darryl will see this - I think he (or camickr) has a nice implementation. Google will find it, and it's worth study as well as use.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,240
    Rep Power
    19

    Default Re: Is it possible to stack one ImageIcon on another?

    That would be camickr's Compound Icon Java Tips Weblog

    db
    Fubarable likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Using ImageIcon
    By David1234204 in forum AWT / Swing
    Replies: 4
    Last Post: 03-21-2012, 08:14 PM
  2. Replies: 2
    Last Post: 01-14-2012, 08:56 PM
  3. How to add an ImageIcon on a JPanel???
    By Angelo in forum AWT / Swing
    Replies: 22
    Last Post: 12-19-2011, 02:27 PM
  4. Need help with ImageIcon and int
    By proceeded in forum New To Java
    Replies: 9
    Last Post: 01-23-2011, 10:10 PM
  5. ImageIcon HELP!
    By ben1989 in forum New To Java
    Replies: 1
    Last Post: 05-05-2010, 08:48 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
  •