posted 19 years ago
Hi !
I have the follow problem.I have a button with a icon(gif) and no text, I set the icon with : button.setIcon(....).The icon size is 16,16 but my button is a little bit bigger that my icon.
What I need a "small" button - with the same size with its icon.
A solution is to use setPreferredSize method on my button(the pref. size is the icon size) but I not so "happy" with this.
The logic behind this is : if the button content(picure and/or text) size is smaller than the preffered size than the last one(pref. size) is used, the button takes its icon size only if the icon is bigger that its preffered size.
There are also other solutions/comments?
SCJP, SCJD, SCWCD, OCPJBCD