Package javax.swing.text

Examples of javax.swing.text.Style.addAttribute()


        final Enumeration keys = htmlAttrSet.getAttributeNames();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = htmlAttrSet.getAttribute(key);
            if (key instanceof CSS.Attribute) {
                result.addAttribute(key, value);
            } else {
                Object cssKey = HTML_ATTRIBUTE_TO_CSS.get(key);
                if (cssKey != null
                    && ((Attribute)cssKey).getConverter() != null) {
View Full Code Here


                    } else {
                        value = ((Attribute)cssKey).getConverter().toCSS(value);
                    }

                    if (value != null) {
                        result.addAttribute(cssKey, value);
                    }
                }
            }
        }
        return result;
View Full Code Here

        }

        final Style style = getDefaultStyle(e);

        updateFontAttributes(style, f);
        style.addAttribute(StyleConstants.Foreground, pane.getForeground());
   }

    protected  String getPropertyPrefix() {
        return propertyPrefix;
    }
View Full Code Here

        final Enumeration keys = htmlAttrSet.getAttributeNames();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = htmlAttrSet.getAttribute(key);
            if (key instanceof CSS.Attribute) {
                result.addAttribute(key, value);
            } else {
                Object cssKey = HTML_ATTRIBUTE_TO_CSS.get(key);
                if (cssKey != null
                    && ((Attribute)cssKey).getConverter() != null) {
View Full Code Here

                    } else {
                        value = ((Attribute)cssKey).getConverter().toCSS(value);
                    }

                    if (value != null) {
                        result.addAttribute(cssKey, value);
                    }
                }
            }
        }
        return result;
View Full Code Here

        }

        final Style style = getDefaultStyle(e);

        updateFontAttributes(style, f);
        style.addAttribute(StyleConstants.Foreground, pane.getForeground());
   }

    protected  String getPropertyPrefix() {
        return propertyPrefix;
    }
View Full Code Here

        final Enumeration keys = htmlAttrSet.getAttributeNames();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = htmlAttrSet.getAttribute(key);
            if (key instanceof CSS.Attribute) {
                result.addAttribute(key, value);
            } else {
                Object cssKey = HTML_ATTRIBUTE_TO_CSS.get(key);
                if (cssKey != null
                    && ((Attribute)cssKey).getConverter() != null) {
View Full Code Here

                    } else {
                        value = ((Attribute)cssKey).getConverter().toCSS(value);
                    }

                    if (value != null) {
                        result.addAttribute(cssKey, value);
                    }
                }
            }
        }
        return result;
View Full Code Here

        // Foreground
        assertFalse(Color.BLUE.equals(style.getAttribute(StyleConstants.Foreground)));
        textPane.setForeground(Color.BLUE);
        assertEquals(Color.BLUE, style.getAttribute(StyleConstants.Foreground));
        // Document
        style.addAttribute(StyleConstants.Subscript, Boolean.TRUE);
        StyledDocument newDoc = new DefaultStyledDocument();
        Style newStyle = newDoc.getStyle(StyleContext.DEFAULT_STYLE);
        assertNull(newStyle.getAttribute(StyleConstants.FontSize));
        assertNull(newStyle.getAttribute(StyleConstants.FontFamily));
        newStyle.addAttribute(StyleConstants.FontFamily, "family2");
View Full Code Here

        style.addAttribute(StyleConstants.Subscript, Boolean.TRUE);
        StyledDocument newDoc = new DefaultStyledDocument();
        Style newStyle = newDoc.getStyle(StyleContext.DEFAULT_STYLE);
        assertNull(newStyle.getAttribute(StyleConstants.FontSize));
        assertNull(newStyle.getAttribute(StyleConstants.FontFamily));
        newStyle.addAttribute(StyleConstants.FontFamily, "family2");
        newStyle.addAttribute(StyleConstants.FontSize, new Integer(10));
        newStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
        newStyle.addAttribute(StyleConstants.Subscript, Boolean.FALSE);
        newStyle.addAttribute(StyleConstants.Foreground, Color.RED);
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.