pack() method for JButton?
Is there anything in the JButton class that acts like JFrame's pack() method? I'm looking for something that does two things:
1) automatically sizes the button to fit its text snugly and doesn't crop it.
2) minimizes the overall size of the button so that the text is still fully visible (i.e. not cropped) yet no space surrounding the text is wasted.
I know I can use setPreferredSize(Dimension) to do this, but that requires a bit of trial and error before you get it right. I'm wondering if there's an alternative that gets it right the first time.