Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fit image to JLabel or JButton

843806Apr 14 2008 — edited Apr 15 2008
I have searched the topic and found some instances of the Image package being used to resize images.

I have a DB of images (think photos) that I want to display based on user input. The display size will be the same but the actual picture dimensions stored in the DB won't necessarily be.

My experience is that the amount of image displayed in the JLabel is entirely based on the size of the image itself (i.e. a small image is completely displayed while a large image is partially displayed.

I wish to have the image fit to the JLabel (or JButton) dynamically.

Is there an obvious method I am overlooking?

TIA,
Sil
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2008
Added on Apr 14 2008
5 comments
2,609 views