Java JEditorPane SetEditorProperties(JEditorPane editor, String text)

Here you can find the source of SetEditorProperties(JEditorPane editor, String text)

Description

Sets the JEditor pane the properties used for the RTFEditor pane and assigns it the text

License

Open Source License

Parameter

Parameter Description
editor a parameter
text a parameter

Declaration

public static void SetEditorProperties(JEditorPane editor, String text) 

Method Source Code


//package com.java2s;
/*Copyright 2008 by Vladimir Polony, Stupy 24, Banska Bystrica, Slovakia
    /*from www .  j  ava2  s  .  c  om*/
This file is part of OpenRep FREE homeopathic software.
    
OpenRep FREE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
OpenRep FREE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with OpenRep FREE.  If not, see <http://www.gnu.org/licenses/>.*/

import java.awt.Color;

import javax.swing.JEditorPane;
import javax.swing.text.rtf.RTFEditorKit;

public class Main {
    /** Sets the JEditor pane the properties used for the RTFEditor pane and assigns it the text
     * 
     * @param editor
     * @param text
     * @return
     */
    public static void SetEditorProperties(JEditorPane editor, String text) {
        RTFEditorKit html = new RTFEditorKit();
        editor.setBackground(Color.white);
        editor.setEditorKit(html);
        editor.setText(text);
        editor.setCaretPosition(0);
    }
}

Related

  1. installTextStyle(JEditorPane control, String styleName)
  2. panelForHtml(JEditorPane editorPane)
  3. scrollToTop(final JEditorPane editor)
  4. scrollToTop(JEditorPane editor)
  5. setDefaultFontToEditorPane(JEditorPane editor, boolean justify)
  6. setJEditorPaneBackground(javax.swing.JEditorPane jEditorPane, Color color)
  7. setParagraphAttributes(final AttributeSet attr, final boolean replace, final JEditorPane editorPane, final StyledDocument doc)
  8. start(JEditorPane textPane)