//A JLabel that uses inline HTML to format its text.
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class SwingHtmlLabel extends JPanel {
public static final String markup = "line 1"
+ "big blue line 2
line 3";
public static void main(String argv[]) {
JPanel p = new JPanel(new java.awt.GridLayout(0, 1));
p.add(new JLabel(markup));
p.add(new java.awt.Label(markup));
JFrame f = new JFrame("SwingHtmlLabel");
f.setContentPane(p);
f.setSize(600, 200);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}