Package javax.swing.text.html

Examples of javax.swing.text.html.StyleSheet


     * @see freeplane.view.mindmapview.EditNodeBase.Dialog#close()
     */
    @Override
    protected void cancel() {
      super.cancel();
      final StyleSheet styleSheet = htmlEditorPanel.getDocument().getStyleSheet();
      styleSheet.removeStyle("p");
      styleSheet.removeStyle("BODY");
      getBase().getEditControl().cancel();
    }
View Full Code Here


     * @see freeplane.view.mindmapview.EditNodeBase.Dialog#split()
     */
    @Override
    protected void split() {
      super.split();
      final StyleSheet styleSheet = htmlEditorPanel.getDocument().getStyleSheet();
      styleSheet.removeStyle("p");
      styleSheet.removeStyle("body");
      getBase().getEditControl().split(HtmlUtils.unescapeHTMLUnicodeEntity(htmlEditorPanel.getDocumentText()),
          htmlEditorPanel.getCaretPosition());
    }
View Full Code Here

  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

                    }
                    buf.append('"').append(newFont.getFamily()).append('"');
                    buf.append(" }");
                    String cssData = buf.toString();
                       
                    StyleSheet styleSheet;
                   
                    /* Update the default style sheet: */
                    styleSheet = ((HTMLEditorKit) ek).getStyleSheet();
                    styleSheet.addRule(cssData);
                   
                    /*
                     * Update the current document's style sheet, thus forcing
                     * the view to be refreshed:
                     */
                    styleSheet = ((HTMLDocument) html.getDocument()).getStyleSheet();
                    styleSheet.addRule(cssData);
                }
            }else if (changeName.equals("clear")) {
                html.setText("");
            }else if (changeName.equals("reload")) {
    URL url = html.getPage();
View Full Code Here

     * the index "x"
     * </ul>
     */
    public void setTextFontSize(String size) {
  int newsize, tmp;
  StyleSheet css = doc.getStyleSheet();
  try {
      if (size.equals("xx-small")) {
    newsize = (int)css.getPointSize(0);
      } else if (size.equals("x-small")) {
    newsize = (int)css.getPointSize(1);
      } else if (size.equals("small")) {
    newsize = (int)css.getPointSize(2);
      } else if (size.equals("medium")) {
    newsize = (int)css.getPointSize(3);
      } else if (size.equals("large")) {
    newsize = (int)css.getPointSize(4);
      } else if (size.equals("x-large")) {
    newsize = (int)css.getPointSize(5);
      } else if (size.equals("xx-large")) {
    newsize = (int)css.getPointSize(6);
      } else if (size.equals("bigger")) {
    newsize = (int)css.getPointSize("+1");
      } else if (size.equals("smaller")) {
    newsize = (int)css.getPointSize("-1");
      } else if (size.endsWith("pt")) {
    String sz = size.substring(0, size.length() - 2);
    newsize = Integer.parseInt(sz);
      } else {
    newsize = (int) css.getPointSize(size);
      }
  } catch (NumberFormatException nfe) {
      return;
  }
  if (newsize == 0) {
View Full Code Here

     *
     * @return the model
     */
    public Document createDefaultDocument()
    {
        StyleSheet styles = getStyleSheet();
        StyleSheet ss = new StyleSheet();

        ss.addStyleSheet(styles);

        HTMLDocument doc = new CustomHTMLDocument(ss);
        doc.setParser(getParser());
        doc.setAsynchronousLoadPriority(4);
        doc.setTokenThreshold(100);
View Full Code Here

     *
     * @return A <code>StyleSheet</code> containing the default HTML element styles.
     */
    public StyleSheet getStyleSheet()
    {
        StyleSheet style;

        if (useDefaultStyles)
        {
            if (defaultStyles == null) defaultStyles = loadStyles();
            style = defaultStyles;
View Full Code Here

     *
     * @return styles.
     */
    protected StyleSheet loadStyles()
    {
        StyleSheet styles = new StyleSheet();
        styles.addStyleSheet(super.getStyleSheet());

        try
        {
            String path = ResourceUtils.getString(stylesheetResourceID);
            InputStream is = ResourceUtils.getInputStream(path);
            Reader r = new BufferedReader(new InputStreamReader(is));
            styles.loadRules(r, null);
            r.close();
        } catch (Throwable e)
        {
            // on error we simply have no styles... the html
            // will look mighty wrong but still function.
View Full Code Here

    /**
     * Update any cached values that come from attributes.
     */
    protected void setPropertiesFromAttributes()
    {
        StyleSheet sheet = getStyleSheet();
        this.attr = sheet.getViewAttributes(this);

        // Gutters
        borderSize = (short)getIntAttr(HTML.Attribute.BORDER, isLink() ? LINK_BORDER : 0);
        if (borderSize == 0 && image == null) borderSize = 1;

View Full Code Here

        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

TOP

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

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.