RTFEditorKitpublic class RTFEditorKit extends StyledEditorKit 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. |
Constructors Summary |
---|
public RTFEditorKit()Constructs an RTFEditorKit.
super();
|
Methods Summary |
---|
public java.lang.String | getContentType()Get the MIME type of the data that this
kit represents support for. This kit supports
the type text/rtf .
return "text/rtf";
| public void | read(java.io.InputStream in, javax.swing.text.Document doc, int pos)Insert content from the given stream which is expected
to be in a format appropriate for this kind of content
handler.
if (doc instanceof StyledDocument) {
// PENDING(prinz) this needs to be fixed to
// insert to the given position.
RTFReader rdr = new RTFReader((StyledDocument) doc);
rdr.readFromStream(in);
rdr.close();
} else {
// treat as text/plain
super.read(in, doc, pos);
}
| public void | read(java.io.Reader in, javax.swing.text.Document doc, int pos)Insert content from the given stream, which will be
treated as plain text.
if (doc instanceof StyledDocument) {
RTFReader rdr = new RTFReader((StyledDocument) doc);
rdr.readFromReader(in);
rdr.close();
} else {
// treat as text/plain
super.read(in, doc, pos);
}
| public void | write(java.io.OutputStream out, javax.swing.text.Document doc, int pos, int len)Write content from a document to the given stream
in a format appropriate for this kind of content handler.
// PENDING(prinz) this needs to be fixed to
// use the given document range.
RTFGenerator.writeDocument(doc, out);
| public void | write(java.io.Writer out, javax.swing.text.Document doc, int pos, int len)Write content from a document to the given stream
as plain text.
throw new IOException("RTF is an 8-bit format");
|
|