import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.WindowConstants;
public class Main {
public static void main(String[] args) {
String HTMLTEXT = "<html><head><style>.foot{color:red} .head{color:black}</style></head>"
+ "<span style='font-family:consolas'>w3cschool.cn</span><br/>"
+ "<span style='font-family:tahoma'>w3cschool.cn</span>";
JTextPane textPane1 = new JTextPane();
textPane1.setContentType("text/html");
textPane1.setText(HTMLTEXT);
JFrame f = new JFrame();
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.getContentPane().add(new JScrollPane(textPane1));
f.setSize(320, 240);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}