public virtual void ClearDocument() { editorPane.SetContentType("text/rtf"); IDocument doc = new DefaultStyledDocument(); editorPane.SetDocument(doc); // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); // StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans Unicode"); log.Info("attr: " + defaultAttrSet); try { doc.InsertString(0, " ", defaultAttrSet); } catch (Exception ex) { throw new Exception(ex); } editorPane.SetEditable(true); editorPane.Revalidate(); editorPane.Repaint(); saveUntagged.SetEnabled(false); saveTaggedAs.SetEnabled(false); taggedContents = null; untaggedContents = null; htmlContents = null; loadedFile = null; }
// private String initText = "In"; private void BuildContentPanel() { editorPane = new JEditorPane(); editorPane.SetContentType("text/rtf"); editorPane.AddKeyListener(new NERGUI.InputListener(this)); // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); StyleConstants.SetFontFamily(defaultAttrSet, "Lucinda Sans"); IDocument doc = new DefaultStyledDocument(); editorPane.SetDocument(doc); try { doc.InsertString(0, initText, defaultAttrSet); } catch (Exception ex) { throw new Exception(ex); } JScrollPane scrollPane = new JScrollPane(editorPane); frame.GetContentPane().Add(scrollPane, BorderLayout.Center); editorPane.SetEditable(true); }