ComboBoxRenderer with image scaling

hi all,

I would like to know how to make the comboBoxRender with image scaling. Because my combo box is smaller than the image that I want to put inside..

currently, I"extends JLabel implements ListCellRenderer", but if I call setIcon to the Label, it is not scale to the combo size..., so I think is it need to extends another type of component ?

Could some of you give me a suggestion , better provide me a simple code.. Many Thanks for help.

[477 byte] By [mcstevenjpa] at [2007-11-27 9:37:08]
# 1
new ImageIcon(new ImageIcon(imgURL).getImage().getScaledInstance(-1, 20, 0))
Andre_Uhresa at 2007-7-12 23:07:44 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi,

I've extended the Icon framework to support scaling. I never tried it with cell renderers, but maybe it works:

Extend JXIconLabel, set the zoomingStrategy to FullZooming.RESPECTING_ASPECT_RATIO_INSTANCE and set the XIcon (eg. a XImageIcon).

Maybe it works. (The library is open source.)

http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JXIconLabel.html

Homepage:

http://www.softsmithy.org

Download:

http://sourceforge.net/project/showfiles.php?group_id=64833

Source:

http://sourceforge.net/svn/?group_id=64833

http://softsmithy.svn.sourceforge.net/viewvc/softsmithy/trunk/lib/src/org/softsmithy/lib/

API:

http://softsmithy.sourceforge.net/lib/docs/api/index.html

If you have questions just ask me!

-Puce

Pucea at 2007-7-12 23:07:44 > top of Java-index,Desktop,Core GUI APIs...