Code example for HTMLDocument

0
 * @author nantuko 
 */ 
public class ColorPane extends JEditorPane {
 
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc =  new HTMLDocument();
     
    public ColorPane() { 
        this.setEditorKit(kit);
        this.setDocument(doc);
    } 
    /** 
     * This method solves the known issue with Nimbus LAF background transparency and background color. 
     * @param color 
     */ 
    public void setExtBackgroundColor(Color color) {
        setBackground(new Color(0,0,0,0));
        JPanel jPanel = new JPanel();
        jPanel.setBackground(color);
        setLayout(new BorderLayout());