Code example for HTMLDocument

Methods: getStyleSheet

0
	textArea.setEditable(false);
 
	Font font = UIManager.getFont("Label.font");
	String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }";
	HTMLDocument doc = (HTMLDocument) textArea.getDocument();
	doc.getStyleSheet().addRule(bodyRule);
 
	textArea.setText(textValue);
    } 
 
    @Override 
    public Component getComponent() {
	return textArea;
    } 
 
    @Override 
    public boolean validate() { 
	return true; 
    } 
 
Connect your IDE to all the code out there  Get Codota for Java