Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLEditorKit


    RichEditor(ClientApplet cap) {
  super();
  capp = cap;
  setEditable(false);
  setContentType("text/html");
  HTMLEditorKit kit = new HTMLEditorKit();
  StyleSheet css = new StyleSheet();
  css.addRule("BODY{ margin : 0;}");
  css.addRule("P{ margin : 0;}");
  css.addRule("A{ color:#0000FF; text-decoration:underline;}");
  kit.setStyleSheet(css);
  setEditorKit(kit);
  setBackground(new Color(249, 249, 250));
 
    }
View Full Code Here


     * @param s
     *  the error message
     */
    public void error(String s) {
  HTMLDocument doc = (HTMLDocument) getDocument();
  HTMLEditorKit kit = (HTMLEditorKit) getEditorKit();
  try {
      kit.insertHTML(doc, doc.getLength(),
        "<font color=#CC0000><b> " + s + "<b><br></font>",
        0, 0, HTML.Tag.FONT);
      setCaretPosition(doc.getLength());
  } catch (Throwable t) {
  }
View Full Code Here

  if(null == comm.getMsgFrom()) {
      sender = "";
  }
  s = "<font color=black><b> " + s + "<b></font>";
  HTMLDocument doc = (HTMLDocument) getDocument();
  HTMLEditorKit kit = (HTMLEditorKit) getEditorKit();
  System.out.println("message befor rep " + s);
  s = replaceImage(":\\)", s, capp.getSmileyPath());
  s = replaceImage(":\\(", s, capp.getSaddyPath());
  s = replaceImage(":\\$", s, capp.getWinkingPath());
  s = replaceImage(":p", s, capp.getTonguePath());
  s = replaceImage(":o", s, capp.getOhPath());
  s = replaceImage(":\\?", s, capp.getQuestionPath());
 
  String msg = sender + pvt + s;
  try {
      kit.insertHTML(doc, doc.getLength(), msg,
        0, 0, HTML.Tag.FONT);
      setCaretPosition(doc.getLength());
      capp.playRecieveSound();
  } catch (Throwable t) {
  }
View Full Code Here

       
      if (LOG.isDebugEnabled())
        LOG.debug(Messages.getString("UrlDataItem.9")+title); //$NON-NLS-1$
     
        // make sure the editor pane is setup for HTML
    HTMLEditorKit kit = new HTMLEditorKit();
    editorPane.setEditorKit(kit);
   
      if (streamSource != null) {
            // stream HTML to the editor pane in blocks of <html>.... </html>
        url = streamSource;
View Full Code Here

  public void Init() {

    DefaultCaret caret = (DefaultCaret) getCaret();
    caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);

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

    kit.getStyleSheet().addRule(""
        + "body {\n"
        + "  font-family: Helvetica, arial, freesans, clean, sans-serif;\n"
        + "  padding: 0px 10px;\n"
        + "}\n"
        + "\n"
View Full Code Here

    {
        panel = new JPanel();
        panel.setLayout(new BorderLayout());

        text = new JEditorPane();
        text.setEditorKit(new HTMLEditorKit());
        text.setEditable(false);
        Dimension size = new Dimension(400, 300);
        text.setMinimumSize(size);
        text.setMaximumSize(size);
        text.setPreferredSize(size);
View Full Code Here

 
  public ChatComponent() {
    super(new BorderLayout());
   
    chatArea = new JEditorPane();
    chatArea.setEditorKit(new HTMLEditorKit());
    chatArea.setDocument(new HTMLDocument());
    chatArea.setEditable(false);
    chatArea.addHyperlinkListener(this);
    this.add(new VerticalJScrollPane(chatArea), BorderLayout.CENTER);
View Full Code Here

    outgoingChatField.setText("");
  }
 
  public void addLine(String line) {
    HTMLDocument chatDocument = (HTMLDocument) chatArea.getDocument();
    HTMLEditorKit chatKit = (HTMLEditorKit) chatArea.getEditorKit();
    try {
      chatKit.insertHTML(chatDocument, chatDocument.getLength(), line, 0, 0, null);
    } catch (BadLocationException | IOException e) {
      e.printStackTrace();
    }
    chatArea.setCaretPosition(chatArea.getDocument().getLength());
  }
View Full Code Here

        Collection installFolders = platform.getInstallFolderURLs();
        if (installFolders.size() > 0) {
            this.platformHome.setForeground(new Color (164,0,0));
            this.platformHome.setText (new File(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
        }
        HTMLEditorKit htmlkit = new HTMLEditorKit();               
        StyleSheet css = htmlkit.getStyleSheet();
        if (css.getStyleSheets() == null) {
            StyleSheet css2 = new StyleSheet();
            Font f = jLabel1.getFont();
            css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
                .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
            css2.addStyleSheet(css);
            htmlkit.setStyleSheet(css2);
        }
        jTextPane1.setEditorKit(htmlkit);       
        jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
    }
View Full Code Here

    }

    protected void configureTextBox(boolean html)
    {
        // Configure the kit and the document
        StyledEditorKit kit = html ? new HTMLEditorKit() : new StyledEditorKit();
        Document document = kit.createDefaultDocument();
        document.addUndoableEditListener(undoHandler);
        resetUndoManager();

        // Apply the kit and the document
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.