private void buildContentPanel ( ) { editorPane = new JEditorPane ( ) ; editorPane . setContentType ( "text/rtf" ) ; editorPane . addKeyListener ( new InputListener ( ) ) ; // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); StyleConstants . setFontFamily ( defaultAttrSet , "Lucida Sans" ) ; Document doc = new DefaultStyledDocument ( ) ; editorPane . setDocument ( doc ) ; try { doc . insertString ( 0 , initText , defaultAttrSet ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } JScrollPane scrollPane = new JScrollPane ( editorPane ) ; frame . getContentPane ( ) . add ( scrollPane , BorderLayout . CENTER ) ; editorPane . setEditable ( true ) ; }
private String initText = In ;