How to create rtf file in java
Rtfeditorkit.
Java RTFEditorKit tutorial with examples
PreviousNext
Rtf template Jrtf Rtfeditorkit Java rtf library Currently I am working on a Java based applivation.
This is the default implementation of RTF editing functionality.
Rtf template
Introduction
This is the default implementation of RTF editing functionality.
The RTF support was not written by the Swing team.
In the future we hope to improve the support provided.
Example
The following code shows how to use RTFEditorKit from javax.swing.text.rtf.
Example 1
import java.awt.BorderLayout; import java.io.FileInputStream; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.text.rtf.RTFEditorKit;publicclass Main extendsJFrame { public Main() throwsException { setSize(400, 240);//www.demo2s.comJPanel topPanel = newJPanel(); topPanel.setLayout(newBorderLayout()); getContentPane().add(topPanel, BorderLayout.CENTER); RTFEditorKit rtf = newRTFEditorKit();JEditorPane editor = newJEditorPane(); editor.setEditorKit(rtf); JScrollPane scroller = newJScrollPane(); scroller.getViewport().add(editor); topPanel.add(scrol