I attached an icon to my JButton. When my JButton is shrinked, my icon shrinks (and finally disappears)as well. What should I do to ensure that the button will wrap around the icon?
Note that the picture shows my button with the icon.
Printable View
I attached an icon to my JButton. When my JButton is shrinked, my icon shrinks (and finally disappears)as well. What should I do to ensure that the button will wrap around the icon?
Note that the picture shows my button with the icon.
Try setting preferred and minimum size on the button.
I tried. it shrinks my button AND my icon as well. not what I want.
What shrinks them? I assume you are setting the values to at least the size of the image...
If your image is too large to start with, use a editing tool and scale it down.
I scaled my image down already. It can be seen in my diagram. But when the button is shrink, the icon also shrink. The icon never fits the button!
Well you can try to place an image to your button with java2D. Maybe it is your JRE problems (
Maybe the icon you want to add for your button is too large. Try to make it smaller and try again )