Link to home
Start Free TrialLog in
Avatar of Vanavah Edwards
Vanavah Edwards

asked on

Reducing image size in a combobox for proper fitting and/or to my specification

How to reduce an image size in a combobox for proper fitting and/or to my specification
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vanavah Edwards
Vanavah Edwards

ASKER

I am reviewing them now.
I review all the others but the easiest one with the least code that worked in my class is the first one.
http://stackoverflow.com/questions/2856480/resizing-a-imageicon-in-a-jbutton
Only 3 lines of code below.  There is one point to consider, when you reduce the image size the comboxbox if set to a particular size will remain bigger than the image.  To make the combobox the same size as the image automatically set the  "renderer.setPreferredSize(null);" to null for the combobox.
Thank you very much you have been so helpful and save me alot of time.  I appreciate your efforts.  I will now award you and put some more quesitions out.
Image img = images[i].getImage();   
Image newimg = img.getScaledInstance(50,50, java.awt.Image.SCALE_SMOOTH); // where 50,50 is the width,height
images[i] = new ImageIcon(newimg);

Open in new window

Great!
You are always welcome.