Package javax.swing.text

Examples of javax.swing.text.Style


            }

            Iterator si = rs.getSelectors();
            while (si.hasNext()) {
                String selector = new Selector((String)si.next()).toString();
                Style rr = getStyle(selector);
                if (rr == null) {
                    rr = addStyle(selector, null);
                    addStyleToCascadedStyles(selector);
                }
                if (asResolver) {
                    final AttributeSet resolver = rr.getResolveParent();
                    final MutableAttributeSet importedAttrs =
                        resolver instanceof MutableAttributeSet
                        ? (MutableAttributeSet)resolver
                        : addStyle(null, null);
                    importedAttrs.addAttributes(attrs);
                    rr.setResolveParent(importedAttrs);
                } else {
                    rr.addAttributes(attrs);
                }
            }
        }
    }
View Full Code Here


    public boolean isDefined(final Object arg0) {
        Iterator it = styleList.iterator();
        boolean result = false;
        while (!result && it.hasNext()) {
            Style style = styleSheet.getStyle(it.next().toString());
            result = style.isDefined(arg0);
        }
        if (result) {
            return result;
        }
View Full Code Here

    public Object getAttribute(final Object key) {
        Iterator it = styleList.iterator();
        Object result = null;
        while (result == null && it.hasNext()) {
            Style style = styleSheet.getStyle(it.next().toString());
            result = style.getAttribute(key);
        }
        if (result != null) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here

        while (result == null && it.hasNext()) {
            Selector styleSelector = (Selector)it.next();
            if (!elementSelector.applies(styleSelector.getLastSelector())) {
                continue;
            }
            Style style = styleSheet.getStyle(styleSelector.toString());
            result = style.getAttribute(key);
        }
        if (result != null) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here

    public boolean containsAttribute(final Object arg0, final Object arg1) {
        Iterator it = styleList.iterator();
        boolean result = false;
        while (!result && it.hasNext()) {
            Style style = styleSheet.getStyle(it.next().toString());
            result = style.containsAttribute(arg0, arg1);
        }
        if (result) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here

            if (doc != null) {
                doc.addDocumentListener(docListener);
                if (doc instanceof StyledDocument) {
                    StyledDocument sd = (StyledDocument) doc;
                    Style style = sd.getStyle(StyleContext.DEFAULT_STYLE);
                    StyleConstants.setFontFamily(style, "SansSerif");
                   
                    attrNormal = style;
                   
                    attrAddedLocally = sd.addStyle(STYLE_ADDED_LOCALLY, attrNormal);
View Full Code Here

    textPane = new JTextPane();
   
    styledDoc = textPane.getStyledDocument();

    //..Regulat Text Style
    Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    Style regular = styledDoc.addStyle("regular", def);
    StyleConstants.setForeground(regular, Color.BLACK);
    StyleConstants.setBackground(regular, Color.WHITE);
    StyleConstants.setFontFamily(regular, "Courier New");
    StyleConstants.setFontSize(regular,12);
    StyleConstants.setLineSpacing(regular, 0.25f);

    //..Keyword1 Text Style
    Style keyword1Style =  styledDoc.addStyle("keyword1Style", regular);
    StyleConstants.setForeground(keyword1Style, Color.RED);
    StyleConstants.setBackground(keyword1Style, Color.YELLOW);
    StyleConstants.setFontFamily(keyword1Style, "Courier New");
    StyleConstants.setFontSize(keyword1Style,12);
    StyleConstants.setBold(keyword1Style,false);
    StyleConstants.setLineSpacing(keyword1Style, 0.25f);

    //..Keyword2 Text Style
    Style keyword2Style =  styledDoc.addStyle("keyword2Style", regular);
    StyleConstants.setForeground(keyword2Style, Color.GREEN);
    StyleConstants.setBackground(keyword2Style, Color.YELLOW);
    StyleConstants.setFontFamily(keyword2Style, "Courier New");
    StyleConstants.setFontSize(keyword2Style,12);
    StyleConstants.setBold(keyword2Style,false);
View Full Code Here

        final Font f = pane.getFont();
        if (f == null) {
            return;
        }

        final Style style = getDefaultStyle(e);

        updateFontAttributes(style, f);
        style.addAttribute(StyleConstants.Foreground, pane.getForeground());
   }
View Full Code Here

      StyledDocument doc,
      PageAnalysis pageAnalysis) {
    if ((doc == null) || (pageAnalysis == null)) {
      return;
    }
    Style style = doc.getStyle(ConfigurationValueStyle.COMMENTS.getName());
    List<Area> areas = pageAnalysis.getAreas().getAreas();
    if (areas != null) {
      for (Area area : areas) {
        int beginIndex = area.getBeginIndex();
        int endIndex = area.getEndIndex();
View Full Code Here

      int begin, int end) {
    for (int i = begin; i < end; i++) {
      PageElement element = elements.get(i);
      int beginIndex = element.getBeginIndex();
      int endIndex = element.getEndIndex();
      Style style = null;
      if (element instanceof PageElementCategory) {
        style = doc.getStyle(ConfigurationValueStyle.CATEGORY.getName());
      } else if (element instanceof PageElementComment) {
        style = doc.getStyle(ConfigurationValueStyle.COMMENTS.getName());
      } else if (element instanceof PageElementExternalLink) {
View Full Code Here

TOP

Related Classes of javax.swing.text.Style

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.