0

How can I set the image?

I tried to set the image through setBounds and setSize but the image is not correctly set , the image is visible and the size is by default, how I set the image correctly by own? https://code.sololearn.com/cf7ZE5g5h3dp/?ref=app

2nd Nov 2022, 11:46 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
4 Antworten
+ 1
I would say you need to use createImageIcon() ImageIcon i1 = createImageIcon("laughing.png"); https://docs.oracle.com/javase/tutorial/uiswing/components/icon.html
2nd Nov 2022, 3:23 PM
Denise Roßberg
Denise Roßberg - avatar
2nd Nov 2022, 3:31 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
I try this one, Thank you 😊
2nd Nov 2022, 3:33 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
0
But how I set the image because I make project guess emoji song then I put the multiple images so it's necessary for me to set the image size.
2nd Nov 2022, 3:27 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar