void () { myEditorPane.setFont(getFont()); myEditorPane.setForeground(getForeground()); EditorKit kit = myEditorPane.getEditorKit(); if (kit instanceof HTMLEditorKit) { StyleSheet css = ((HTMLEditorKit)kit).getStyleSheet(); css.addRule("body, p {" + "color:#" + ColorUtil.toHex(getForeground()) + ";" + "font-family:" + getFont().getFamily() + ";" + "font-size:" + getFont().getSize() + "pt;" + "white-space:" + (myAllowAutoWrapping ? "normal" : "nowrap") + ";}"); } }