Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLEditorKit


        if (document instanceof HTMLDocument)
        {
            HTMLDocument htmlDocument = (HTMLDocument)document;
            int offset = editor.getSelectionStart();

            HTMLEditorKit kit = (HTMLEditorKit)editor.getEditorKit();
            try
            {
                htmlDocument.remove(offset, editor.getSelectionEnd() - offset);
                kit.insertHTML(htmlDocument, offset, txt, 0, 0, HTML.Tag.A);
            } catch (Throwable e)
            {
                LOG.log(Level.WARNING, "Failed to insert link", e);
            }
        } else
View Full Code Here


            mRequestURL = requestURL;
            mRequestURLWWW = "http://www." + mRequestURL.substring(7);
        }

        // Trick gets Swing's HTML parser
        Parser parser = (new HTMLEditorKit() {
            public Parser getParser()
            {
                return super.getParser();
            }
        }).getParser();
View Full Code Here

    private final List<String> hrefs;
   
    public HTMLSuiteResult(String originalSuite) {
        //this.originalSuite = originalSuite;
        StringReader s = new StringReader(originalSuite);
        HTMLEditorKit k = new HTMLEditorKit();
        HTMLDocument doc = (HTMLDocument) k.createDefaultDocument();
        Parser parser = doc.getParser();
        HrefConverter p = new HrefConverter(originalSuite);
        doc.setAsynchronousLoadPriority(-1);
        try {
            parser.parse(s, p, true);
View Full Code Here

     *
     * @param editorPane
     * @param editorPaneScroll
     */
    private static void adjustEditorPane(JEditorPane editorPane, JScrollPane editorPaneScroll) {
        editorPane.setContentType(new HTMLEditorKit().getContentType());

        editorPane.addHyperlinkListener(new HyperlinkHandler());
        editorPane.setEditable(false);

//        editorPane.setOpaque(true);
View Full Code Here

    private void initAdmin() throws RemoteException {
        admin.setGUI(this);
        username = admin.getUsername();
        model = new DefaultListModel();
        users = new ArrayList<String>();
        htmlKit = new HTMLEditorKit();
        Utils.setCSSRule(htmlKit);
        setTitle(username);
    }
View Full Code Here

    private void initUser() throws RemoteException {
        user.setGUI(this);
        username = user.getUsername();
        model = new DefaultListModel();
        users = new ArrayList<String>();
        htmlKit = new HTMLEditorKit();
        Utils.setCSSRule(htmlKit);
        setTitle(username);
    }
View Full Code Here

    public InputStream getDestinationStream(InputStream source)
            throws Exception
    {
        // try and read the document - set to ignore character set directive,
        // assuming that the input stream is already set properly (I hope)
        HTMLEditorKit kit = new HTMLEditorKit();
        Document doc = kit.createDefaultDocument();

        doc.putProperty("IgnoreCharsetDirective", new Boolean(true));

        kit.read(source, doc, 0);

        String extractedText = doc.getText(0, doc.getLength());

        // generate an input stream with the extracted text
        byte[] textBytes = extractedText.getBytes();
View Full Code Here

                previewIsObsolete = true;
            }
        });

        // Setup the editor pane for rendering HTML.
        final HTMLEditorKit kit = new MarkdownEditorKit(document);
        final StyleSheet style = new StyleSheet();
        style.importStyleSheet(MarkdownPreviewEditor.class.getResource(PREVIEW_STYLESHEET_PATH));
        kit.setStyleSheet(style);
        jEditorPane.setEditorKit(kit);
        jEditorPane.setEditable(false);

        // Set the editor pane position to top left, and do not let it reset it
        jEditorPane.getCaret().setMagicCaretPosition(new Point(0, 0));
View Full Code Here

   * Create a new document.
   *
   * @return the created document
   */
  public static HTMLDocument createDocument(){
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    return doc;
 
View Full Code Here

*
*/
public class HtmlDocumentUtils {
 
  public static HTMLDocument createDocument(){
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    return doc;
 
View Full Code Here

TOP

Related Classes of javax.swing.text.html.HTMLEditorKit

Copyright © 2018 www.massapicom. 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.