Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLEditorKit


    contentpane = new JPanel();
    contentpane.setLayout(new VerticalLayout());

    helpPane = new JEditorPane();
    helpPane.setEditable(false);
    helpPane.setEditorKit(new HTMLEditorKit());
    helpPane.setPreferredSize(new Dimension(600, 100));

    final JPanel toolbar = new JPanel();
    toolbar.setLayout(new BorderLayout());
    toolbar.add(new JScrollPane(helpPane));
View Full Code Here


    BLOCK_ELEMENTS = Collections.unmodifiableSet(blockElements);
  }

  public HtmlRichTextConverter()
  {
    editorKit = new HTMLEditorKit();
  }
View Full Code Here

    private HTML() {
    }

    public static void convertHtmlToText(Reader reader, Writer writer) throws IOException, BadLocationException {

        EditorKit kit = new HTMLEditorKit();
        HTMLDocument doc = new HTMLDocument();
        kit.read(reader, doc, 0);

        HTMLtoPlainTextWriter2 x = new HTMLtoPlainTextWriter2(writer, doc);
        x.write();
        writer.close();
View Full Code Here

        styleSheet.addRule("H1 {color: red;  font-size: 120%; font-weight: bold;}");
        styleSheet.addRule("code {font-family: courier; font-size: " + Driver.getFontSize() + "pt}");
        styleSheet.addRule(" a:link { color: #0000FF; } ");
        styleSheet.addRule(" a:visited { color: #800080; } ");
        styleSheet.addRule(" a:active { color: #FF0000; text-decoration: underline; } ");
        HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
        htmlEditorKit.setStyleSheet(styleSheet);
        mainFrame.summaryHtmlArea.setEditorKit(htmlEditorKit);
    }
View Full Code Here

    URL url = new URL("http://www.redhat.com");
    URLConnection connection = url.openConnection();
    InputStream is = connection.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
    HTMLEditorKit.Parser parser = new ParserDelegator();
    HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
    parser.parse(br, callback, true);

    ElementIterator iterator = new ElementIterator(htmlDoc);
View Full Code Here

          JEditorPane pane = new JEditorPane("text/html", html);
          pane.setSize(table.getSize().width, Integer.MAX_VALUE);
          pane.setEditable(false);

          HTMLEditorKit kit = new HTMLEditorKit();
          pane.setEditorKit(kit);

          StyleSheet styleSheet = kit.getStyleSheet();
          styleSheet.addRule("body {font-family:\"Helvetica Neue\", Arial, Helvetica, sans-serif;}");
          styleSheet.addRule("h1 {margin:2px;padding:2px;}");
          styleSheet.addRule("p {margin:2px;padding:2px;}");

          Document doc = kit.createDefaultDocument();
          pane.setDocument(doc);
          pane.setText(html);

          if(hasFocus)
          {
View Full Code Here

            String str = "! (ekt instanceof HTMLEditorKit)";
            GfrHelpBroker._LOGGER_.severe(str);
            return false;
        }

        HTMLEditorKit ektHtml = (HTMLEditorKit) ekt;

        // -------------------------------------
        // 5) assign styleSheet to editorKitHtml

        StyleSheet sstCur = ektHtml.getStyleSheet();

        if (sstCur == null)
        {
            String str = "sstCur == null"; // !!!!!!!!!!
            //GfrHelpBroker._LOGGER_.info(str);
            return true;
        }

        if (this._sst == sstCur)
        {
            String str = "this._sst == sstCur"; // !!!!!!!!!!
            //GfrHelpBroker._LOGGER_.info(str);
            return true;
        }

        if (ektHtml != null) // !!!!
            ektHtml.setStyleSheet(this._sst);
        else
        {
            String str = "ektHtml == null"; // !!!!!!!!!!
            //GfrHelpBroker._LOGGER_.info(str);
        }
View Full Code Here

        errorMessage = new JEditorPane();
        errorMessage.setEditable(false);
        errorMessage.setContentType("text/html");
        errorMessage.setEditorKitForContentType("text/plain", new StyledEditorKit());
        errorMessage.setEditorKitForContentType("text/html", new HTMLEditorKit());

        errorMessage.setOpaque(false);
        errorMessage.putClientProperty(JXEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

        closeButton = new JButton(UIManagerExt.getString(
View Full Code Here

  public ChatEditor() {
    super();

    setContentType("text/html");
    setEditorKit(new HTMLEditorKit() {
      private static final long serialVersionUID = 1L;

      @Override
      public ViewFactory getViewFactory() {
View Full Code Here

        protected Component initComponent() {
            JPanel panel = new JPanel(new TableLayout(new double[][]{{-1},{-1}}));
            panel.setBorder(new LineBorder(Color.DARK_GRAY));

            this.editorPane = new JEditorPane();
            editorPane.setEditorKit(new HTMLEditorKit());
            editorPane.setEditable(false);
            editorPane.setOpaque(false);

            panel.add(new JScrollPane(editorPane), "0,0,FULL,FULL");
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.