HTMLEditorKitは、 JEditorPaneにおいてHTMLを扱うときに使われるユーティリティーのようなクラス。
private void initPane(Container c) { JEditorPane editor = new JEditorPane(); editor.setEditorKit(new HteEditorKit()); 〜 }
public class HteEditorKit extends HTMLEditorKit {
public Object clone() {
HteEditorKit o = (HteEditorKit) super.clone();
if (o != null) {
// oの初期化
// もしメンバー変数を持つなら、ここでoにセットしてやる
}
return o;
}
}
HTMLWriterは、HTML出力を実際に行うクラス。
public class HteEditorKit extends HTMLEditorKit { 〜 public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException { //独自のHTMLWriter HteWriter w = new HteWriter(out, doc, pos, len); w.write(); } }