JLabel Example Multiline Text Java Swing

JLabel Example Multiline Text Java Swing

One of the important features of JLabel is it can be displayed as multiple lines of text with bullets, a very contrast of AWT Label which gives only one line of text. We use HTML here.

Following code on JLabel Example explains.


JLabel Example
Output screen on JLabel Example

lab4.setBorder(BorderFactory.createTitledBorder(“Multi-Line HTML”));

With BorderFactory, different types of borders can be given to Swing components. The borders include:

createTitledBorder, createEtchedBorder, createBevelBorder, createRaisedBevelBorder, createLoweredBevelBorder, createLineBorder, createMatteBorder, createCompoundBorder and createEmptyBorder etc.

JLabel Example

Leave a Reply

Your email address will not be published. Required fields are marked *