new JLabel(String htmlString) (Multi-line Label)
import javax.swing.JFrame;
import javax.swing.JLabel;
public class MainClass {
public static void main(String[] a) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
String htmlLabel = "<html><sup>HTML</sup> <sub><em>Label</em></sub><br>"
+ "<font color=\"#FF0080\"><u>Multi-line</u></font>";
JLabel label = new JLabel(htmlLabel);
frame.add(label);
frame.setSize(300, 200);
frame.setVisible(true);
}
}
Related examples in the same category