This section shows you how to set the multi line label on the button in Java Swing Applications.
This program uses html class from javax.swing.text.html*; package and then breaks the text label of the button into two lines. If you run the program it will look like following image:
This is the class from the javax.swing.text.html.*; package of Java. This class provides the facility to use the html tags in java application for texts. There are <html></html> tag and <br> tag have been used in this program. Tags of html are used with the string which is the label of the button.
Here is the code of the program:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: April 14, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles