LarryAndro
asked on
JLabel Icon Resize
I have a JPanel in which I placed a JLabel of the same size as the JPanel. I set the icon property of the JLabel to a jpg image file. The image file displays, but it is too large, and needs to be resized.
How do I resize the displayed (in the JLabel) icon to be the same height and width as the JLabel?
Possibly, JLabel icons cannot be resized, which would explain why I'm running into a dead end. If so, would someone tell me the best way to display a picture in a JPanel, sized to the same size as the JPanel?
(As an aside, my IDE is Netbeans. But, I think this is just a Java question.)
How do I resize the displayed (in the JLabel) icon to be the same height and width as the JLabel?
Possibly, JLabel icons cannot be resized, which would explain why I'm running into a dead end. If so, would someone tell me the best way to display a picture in a JPanel, sized to the same size as the JPanel?
(As an aside, my IDE is Netbeans. But, I think this is just a Java question.)
One possible solution is to resize .jpg image with some external editor (for example Paint), and use resized image from Netbeans.
ASKER
Thank you for suggestion to resize the actual image. I can do that with a batch image editor like IrfanView. But, since I use the image for several reasons, I would prefer to programmatically resize the image at the time of use.
Hopefully, there is a way...
Hopefully, there is a way...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm testing and researching these techniques. I'll respond shortly. Thanks for help...
ASKER
Success! Great suggestions. (Splitting points.) And, thank you...