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 Answers
+ 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