To create a multi-line JLabel, Samuel Sjoberg provided a custom class that extended the BasicLabelUI class in order to paint text and wrap them to multiple lines rather than displaying the text as one line and truncated with a …

To use the class, just do

Here is the full MultiLineLabelUI class.

To rotate a JLabel‘s text vertically, you only need to use this class and pass it as a parameter to the JLabel‘s setUI() method. Kudos to the developer who created this class to make it easy for other developers to plug this class in and create a vertical JLabel in an instant.

To use this class, check the code below:

This is the code for the VerticalLabelUI class.

Related Posts Plugin for WordPress, Blogger...