Ever wonder why there’s no method to wrap a String based on a certain number of characters in Swing? Me, too. Having the ability to wrap Strings can be especially useful if you don’t know how long your Strings are going to be, such as when you have translated text in a JOptionPane (or any other GUI element). Fortunately, we can write a nice utility class that does exactly what we need — StringWrapper.
Oct
27th
