Any component that can take text can also make HTML text , which will be formatted according to HTML rules. this means you can easily add text decorated in a Swing component.

It must begin with the text "<html>", then you can use the normal HTML tags. Note that it is not forced to include normal closing tag.The ActionListener adds a new JLabel to the form, which also contains HTML text. However, this tag is not added during init () so that should call the validate () method of the container force a redrawing of the components (and thus display the new label). You can also use HTML text for JTabbedPane, JMenuItem, JToolTip, JRadioButton and JCheckBox.Here is the example of HTML text on Swing Components