Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLEditorKit$InsertHRAction


  public Object getObjectInstance(Object mapInstance, Name nameIgnored,
      Context nameCtxIgnored, Hashtable<?, ?> environmentIgnored)
      throws Exception {
    Map map = (Map) mapInstance;

    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    Element root = doc.getDefaultRootElement();//html
    Element element =root.getElement(0);//body
    //doc.insertAfterStart(element, "<table><tr><td>anfang</td><td>ende</td></tr><tr><td>anfang2</td><td>ende2</td></tr></table>");
    doc.insertAfterStart(element, "<table/>");
    Element table = element.getElement(0);//table
View Full Code Here


  
  @SuppressWarnings("unchecked")
@Override
  public HTMLDocument value(Map map, Void... ignored) throws Exception
  {
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    Element root = doc.getDefaultRootElement();//html
    Element element =root.getElement(0);//body
    //doc.insertAfterStart(element, "<table><tr><td>anfang</td><td>ende</td></tr><tr><td>anfang2</td><td>ende2</td></tr></table>");
    doc.insertAfterStart(element, "<table/>");
    Element table = element.getElement(0);//table
View Full Code Here

        JPanel jpDescription = new JPanel(new MigLayout());
        descriptionBorder = BorderFactory.createTitledBorder(brickbreaker
                .getString("TutorialView.1")); //$NON-NLS-1$
        jpDescription.setBorder(descriptionBorder);
        text = new JTextPane();
        text.setEditorKit(new HTMLEditorKit());
        text.setEditable(false);
        text.setBorder(new EmptyBorder(2, 1, 1, 1));
        text.setAutoscrolls(false);
        text.setContentType("text/html"); //$NON-NLS-1$
        text.setFont(text.getFont().deriveFont(Font.PLAIN));
View Full Code Here

        Renderer(JComponent component, String html) {
           
            super(null);
            this.component = component;
           
            HTMLEditorKit kit = new HTMLEditorKit();
            Document doc = kit.createDefaultDocument();
            Reader r = new StringReader(html);
           
            try {
                kit.read(r, doc, 0);
            } catch (Throwable e) {
                // Ignored for now. Need to be tested
            }
           
            factory = kit.getViewFactory();
            son = factory.create(doc.getDefaultRootElement());
            son.setParent(this);
        }
View Full Code Here

  private JEditorPane createJEditorPane() {
    JEditorPane editorPane = new JEditorPane();
    editorPane.setBackground(Color.white);
    editorPane.setEditable(false);
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    // StyleSheet myStyleSheet = new StyleSheet();
    // String normalTextStyle = "font-size: 12px, font-family: georgia";
    // myStyleSheet.addRule("body {" + normalTextStyle + "}");
    // myStyleSheet.addRule("p {" + normalTextStyle + "}");
    // myStyleSheet.addRule("div {" + normalTextStyle + "}");
View Full Code Here

     */
    private void helpVerifyModuleDocPage(ModuleName moduleName, String content, HTMLDocumentationGenerator parent) {
       
        StringReader sourceReader = new StringReader(content);
       
        HTMLEditorKit htmlKit = new HTMLEditorKit();
        HTMLDocument htmlDoc = (HTMLDocument)htmlKit.createDefaultDocument();
        HTMLEditorKit.Parser parser = new ParserDelegator();
        final HTMLEditorKit.ParserCallback docCallback = htmlDoc.getReader(0);
       
        HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback() {

View Full Code Here

    public HtmlTransferable(String htmlString) {
        this.htmlString = htmlString;
       
        // Build an HTML document from the string
       
        HTMLEditorKit htmlKit = new HTMLEditorKit();
        Document doc = htmlKit.createDefaultDocument();
        try {
            htmlKit.read(new StringReader(htmlString), doc, 0);
        } catch (Exception e) {
            throw new IllegalStateException("HtmlTransferable: Error encountered in string conversion: " + e);
        }
       
        // Get the RTF version of the string
View Full Code Here

    }

    private static void checkImages() throws Exception {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                HTMLEditorKit c = new HTMLEditorKit();
                HTMLDocument doc = new HTMLDocument();

                try {
                    c.read(new StringReader("<HTML><TITLE>Test</TITLE><BODY><IMG id=test></BODY></HTML>"), doc, 0);
                } catch (Exception e) {
                    throw new RuntimeException("The test failed", e);
                }

                Element elem = doc.getElement("test");
View Full Code Here

        header.append("</tr></table>");
        header.append("</body></html>");

        // Create the editor pane               
        JEditorPane headerPane = new JEditorPane();
        HTMLEditorKit editorKit = new HTMLEditorKit();
        HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();

        headerPane.setEditorKit(editorKit);
        headerPane.setDocument(doc);
        headerPane.setEditable(false);
        headerPane.setText(header.toString());
View Full Code Here

  public static Color getBorderSeparatorColor() {
    return getBorderColor();
  }

  public static HTMLEditorKit getHTMLEditorKit() {
    final HTMLEditorKit kit = new HTMLEditorKit();

    Font font = getLabelFont();
    @NonNls String family = font != null ? font.getFamily() : "Tahoma";
    int size = font != null ? font.getSize() : 11;

    final StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule(String.format("body, div, p { font-family: %s; font-size: %s; } p { margin-top: 0; }", family, size));
    kit.setStyleSheet(styleSheet);

    return kit;
  }
View Full Code Here

TOP

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

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.