Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Jul 2005

    placing multiple images in Jframe

    I am creating an imageicon from an image and then adding it on Jlabel,then adding that to Jpanel and then fiinally to jframe
    I want to add an extra image on top of the original image(both images need to be displayed)
    This is regarding a multiplayer game where i need to place the image of a player over the background

    Can sometell me what i need to do?Do i have to add an extra Jlabel or an extra Jpanel.
    Thank you
    The strong shall live and the weak will die
    In the end,only the fittest survive in this world
    - Shishio Makoto

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Ok, you need to put the background image on the JPanel, and put the foreground image on the JLabel. Add the JLabel to the JPanel, and make sure that you use setOpaque(false) on the JLabel. This should (note: should, I've never tried this) make everything beyond the image borders transparent.

    Hope I helped!

Posting Permissions

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