Package javax.swing.text.html

Examples of javax.swing.text.html.StyleSheet


  }

  private boolean isInvisible(final javax.swing.text.Element textElement)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    final Object o = attr.getAttribute(CSS.Attribute.DISPLAY);
    if ("none".equals(String.valueOf(o)))
    {
      return true;
View Full Code Here


  }

  private void configureStyle(final javax.swing.text.Element textElement, final Element result)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    parseBorderAndBackgroundStyle(result, sheet, attr);
    parseBoxStyle(result, attr);

    final Font font = sheet.getFont(attr);
    if (font != null)
    {
      result.getStyle().setStyleProperty(TextStyleKeys.FONT, font.getFamily());
      result.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(font.getSize()));
      result.getStyle().setBooleanStyleProperty(TextStyleKeys.ITALIC, font.isItalic());
View Full Code Here

   */
  public EditorPaneLinkDetector() {

    HTMLEditorKit htmlkit = new HTMLEditorKit();

    StyleSheet styles = htmlkit.getStyleSheet();
    StyleSheet ss = new StyleSheet();

    ss.addStyleSheet(styles);

    ss.addRule("body {font-family:arial;font-size:12pt}");
    ss.addRule("p {font-family:arial;margin:2}");

    HTMLDocument doc = new HTMLDocLinkDetector(ss);

    setEditorKit(htmlkit);

View Full Code Here

  @Override
  protected void initStylesForTextPane(final JTextPane textPane) {
    textPane.setContentType("text/html");

    final HTMLDocument doc = (HTMLDocument) textPane.getDocument();
    final StyleSheet css = doc.getStyleSheet();

    /*
     * Configure standard styles
     */
    css.addRule("body { font-family: Dialog; font-size: " + (TEXT_SIZE + 1)
        + "pt }");
    css.addRule("a { color: blue; font-style: italic }");

    css.addRule("._timestamp { color: " + colorToRGB(HEADER_COLOR)
        + "; font-size: " + (TEXT_SIZE - 1)
        + "pt; font-style: italic }");
    css.addRule("._header { color: " + colorToRGB(HEADER_COLOR) + " }");

    /*
     * Configure notification types
     */
    for (final NotificationType type : NotificationType.values()) {
      final Color color = type.getColor();

      if (color != null) {
        css.addRule("." + type.getMnemonic() + " { color: "
            + colorToRGB(color) + "; font-weight: bold; }");
      }
    }
  }
View Full Code Here

        environment.remove("JAVA_OPTIONS");
    }

    public static StyleSheet makeStyleSheet (String name) {
        try {
            StyleSheet sheet = new StyleSheet();
            Reader reader = new InputStreamReader(System.class.getResourceAsStream("/css/" + name + ".css"));
            sheet.loadRules(reader, null);
            reader.close();

            return sheet;
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

  }

  private boolean isInvisible(final javax.swing.text.Element textElement)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    final Object o = attr.getAttribute(CSS.Attribute.DISPLAY);
    if ("none".equals(String.valueOf(o)))
    {
      return true;
View Full Code Here

  }

  private void configureStyle(final javax.swing.text.Element textElement, final Element result)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    parseBorderAndBackgroundStyle(result, sheet, attr);
    parseBoxStyle(result, attr);

    final Font font = sheet.getFont(attr);
    if (font != null)
    {
      result.getStyle().setStyleProperty(TextStyleKeys.FONT, font.getFamily());
      result.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, font.getSize());
      result.getStyle().setBooleanStyleProperty(TextStyleKeys.ITALIC, font.isItalic());
View Full Code Here

        splitP.setBorder(null);
        return splitP;
    }

    private void setStyleSheets() {
        StyleSheet styleSheet = new StyleSheet();
        styleSheet.addRule("body {font-size: " + Driver.getFontSize() + "pt}");
        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

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

    };

  static public StyleSheet s_getDefault()
    {
        StyleSheet sst = new StyleSheet();

        for (int i=0; i<GfrStyleSheet._STRS_DEFAULT_RULE_.length; i++)
            sst.addRule(GfrStyleSheet._STRS_DEFAULT_RULE_[i]);

        // ending
        return sst;
    }
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.