• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

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
0
Vanavah Edwards
Asked:
Vanavah Edwards
  • 2
  • 2
1 Solution
 
Vanavah EdwardsAuthor Commented:
I am reviewing them now.
0
 
Vanavah EdwardsAuthor Commented:
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

0
 
for_yanCommented:
Great!
You are always welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now