Forums Register Login

JButton with ImageIcon Size Problem

+Pie Number of slices to send: Send
Hi,
I have a JButton with an ImageIcon showing just fine.
I need to be able to resize the button and of course its icon, but when the button gets to small the icon disappears.
Is there a way I can dynamically change the size of the icon to fit the JButton? Or am I stuck making several icon files?
Thank You in Advance for Your Help,
Lou
+Pie Number of slices to send: Send
Hi,
If you are using an ImageIcon then it has a getScaledInstance() method. I seem to remember using this for something similar once.
Regards,
Ken
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thank you Craig!
That is exactly what I needed!
Lou
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 22028 times.
Similar Threads
Image as a button
Problems with Image Icons in Forte 3.0
jbutton background image
Icons
How to set .ico - files as icons in an Applet?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:27:33.