Package javax.swing.text.html

Examples of javax.swing.text.html.StyleSheet.addRule()


      final Color bgColor = getBackground();
    ruleBuilder.append("background-color: ").append(ColorUtils.colorToString(bgColor)).append(";");
    ruleBuilder.append("}\n");
    final HTMLDocument document = (HTMLDocument) textfield.getDocument();
    final StyleSheet styleSheet = document.getStyleSheet();
    styleSheet.addRule(ruleBuilder.toString());
    textfield.setText(text);
    final MapView mapView = (MapView) viewController.getMapViewComponent();
    if(! mapView.isValid())
      mapView.validate();
    final NodeStyleController nsc = NodeStyleController.getController(modeController);
View Full Code Here


            }
            if (defaultFont.isBold()) {
                rule += "font-weight: bold; ";
            }
          rule += "}\n";
          styleSheet.addRule(rule);
      }
      if (ResourceController.getResourceController().getBooleanProperty(
          MNoteController.RESOURCES_USE_MARGIN_TOP_ZERO_FOR_NOTES)) {
      /* this is used for paragraph spacing. I put it here, too, as
       * the tooltip display uses the same spacing. But it is to be discussed.
View Full Code Here

       * fc, 23.3.2009.
       */
      String rule = "p {";
      rule += "margin-top:0;";
      rule += "}\n";
      styleSheet.addRule(rule);
    }
  }

  boolean isEditing() {
    final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
View Full Code Here

        editorPane.setCaretColor(textColor);
      }
      final StyleSheet styleSheet = document.getStyleSheet();
      styleSheet.removeStyle("p");
      styleSheet.removeStyle("body");
      styleSheet.addRule(ruleBuilder.toString());
      final URL url = node.getMap().getURL();
      if (url != null) {
        document.setBase(url);
      }
      else {
View Full Code Here

  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

  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

  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

                       
                    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:
                     */
 
View Full Code Here

                    /*
                     * 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

        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);       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.