I am trying to detect whether the text of a JButton fits within the current width, and doesn't overflow like this:

Is this possible, if so how?
You can try to check it like this:
if (myBtn.getPreferredSize().width > myBtn.getSize().width)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With