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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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
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);
Great!
You are always welcome.
You are always welcome.
ASKER