Is there any way to put more than one image on a JLabel?
If not JLabel, what's the best way to put multiple images?
I'm trying to make a card game, that's the reason.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Is there any way to put more than one image on a JLabel?
If not JLabel, what's the best way to put multiple images?
I'm trying to make a card game, that's the reason.
Create a single image by creating a BufferedImage and drawing each image onto that BI and then use the BI in the JLabel.
If you don't understand my answer, don't ignore it, ask a question.
tonynsx (November 24th, 2013)
Or, if you can use standard playing cards (and maybe some not standard) there are open source card back and front images available on the Internet for your use. If you're building your own special cards, I suggest you build and save the card images in advance. Building them on the fly is unnecessary overhead.
tonynsx (November 24th, 2013)
I'll look at the BufferedImage option, I don't know anything about it, so I'll look on YouTube etc.
I already have the 52 cards images available
Why are you using a JLabel for displaying images? Why not use a custom JPanel with its own paintComponent() method that draws as many images as you want?
If you don't understand my answer, don't ignore it, ask a question.