Examples of RTFEditorKit


Examples of javax.swing.text.rtf.RTFEditorKit

{
  private RTFEditorKit editorKit;

  public RtfRichTextConverter()
  {
    editorKit = new RTFEditorKit();
  }
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

        out.close();
    }

    public void writeRTF(OutputStream out)
            throws Exception {
        RTFEditorKit rtf = new RTFEditorKit();

        rtf.write(out, m_doc, 0, m_doc.getLength());
    }
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context)
            throws IOException, SAXException, TikaException {
        try {
            DefaultStyledDocument sd = new DefaultStyledDocument();
            new RTFEditorKit().read(stream, sd, 0);

            XHTMLContentHandler xhtml =
                new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();
            xhtml.element("p", sd.getText(0, sd.getLength()));
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context)
            throws IOException, SAXException, TikaException {
        try {
            Document sd = new CustomStyledDocument();
            new RTFEditorKit().read(stream, sd, 0);

            XHTMLContentHandler xhtml =
                new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();
            xhtml.element("p", sd.getText(0, sd.getLength()));
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

            reader = new FileReader(filename);
            writer = new FileWriter(tempFile);

            DefaultStyledDocument doc = new DefaultStyledDocument();

            new RTFEditorKit().read(reader, doc, 0);

            writer.write(doc.getText(0, doc.getLength()));
        }
        catch (BadLocationException ble) {
            log.fatal("parse() failed with BadLocationException", ble);
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

      }
    }
  }

  private String convert(InputStream rtfDocumentInputStream) throws IOException {
    RTFEditorKit aRtfEditorkit = new RTFEditorKit();

    StyledDocument styledDoc = new DefaultStyledDocument();

    String textDocument;

    try {
      aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);

      textDocument = styledDoc.getText(0, styledDoc.getLength());
    } catch (BadLocationException e) {
      throw new IOException("Error during parsing");
    }
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

    this.isExitButton = isExitButton;

    getContentPane().setLayout(new BorderLayout());
    StyleContext m_context;
    DefaultStyledDocument m_doc;
    RTFEditorKit m_kit;
    m_monitor = new JTextPane();
    /*
     *  m_kit = new RTFEditorKit();
     *  m_monitor.setEditorKit(m_kit);
     *  m_context = new StyleContext();
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

    public Reader extractText(InputStream stream,
                              String type,
                              String encoding) throws IOException {

        try {
            RTFEditorKit rek = new RTFEditorKit();
            DefaultStyledDocument doc = new DefaultStyledDocument();
            rek.read(stream, doc, 0);
            String text = doc.getText(0, doc.getLength());
            return new StringReader(text);
        } catch (BadLocationException e) {
            throw new IOException(e.getMessage());
        } finally {
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

                        JViewerPanel jviewer = new JViewerPanel();
                        String text = FileUtils.readFileToString(file);
                        jviewer.update(text);
                        dialog.add(jviewer);
                } else if (verifier.isRTF(path)) {
                        RTFEditorKit rtf = new RTFEditorKit();
                        JEditorPane editor = new JEditorPane();
                        editor.setEditable(false);
                        editor.setEditorKit(rtf);
                        JScrollPane scroller = new JScrollPane();
                        scroller.getViewport().add(editor);
                        dialog.add(scroller);
                        try {
                                FileInputStream fi = new FileInputStream(file);
                                rtf.read(fi, editor.getDocument(), 0);
                        } catch (Exception exception) {
                                exception.printStackTrace();
                        }
                } else if (verifier.isPicture(path)) {
                        AlphalinePanel viewer = new AlphalinePanel();
View Full Code Here

Examples of javax.swing.text.rtf.RTFEditorKit

    public Reader extractText(InputStream stream,
                              String type,
                              String encoding) throws IOException {

        try {
            RTFEditorKit rek = new RTFEditorKit();
            DefaultStyledDocument doc = new DefaultStyledDocument();
            rek.read(stream, doc, 0);
            String text = doc.getText(0, doc.getLength());
            return new StringReader(text);
        } catch (BadLocationException e) {
            logger.warn("Failed to extract RTF text content", e);
            return new StringReader("");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.