0

I would like to take an image file on disk and display it to fit the size of a jlabel (preserve aspect ratio)
the image can vary in size from 100x100 to 1600x1200 and the size of the jlabel is 256x192 (can change it only slightly if need be.)

I have looked up getScaledInstance on the net, and my befuddled brain cant wrap itself around it

thanks for any help.....

Edited by pritaeas: Moved to Java.

2
Contributors
1
Reply
13
Views
3 Years
Discussion Span
Last Post by JamesCherrill
0

getScaledInstance - just pass it the desired width/height and a scaling method (use SCALE_DEFAULT if yo don't know). It returns a new Image that is the size you requested.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.