Package javax.swing.text.StyleContext

Examples of javax.swing.text.StyleContext.NamedStyle.addAttribute()


    /*
     * NamedStyle(String, Style)
     */
    public void testNamedStyleStringStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle();
        parent.addAttribute("key", "value");
        String name = "style_name";
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(name, parent);
        assertEquals(parent, ns.getResolveParent());
        assertEquals(name, ns.getName());
    }
View Full Code Here


    /*
     * NamedStyle(String, Style)
     */
    public void testNamedStyleStringNullStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle("parentName", null);
        parent.addAttribute("key", "value");
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(null, parent);
        assertEquals(parent, ns.getResolveParent());
        assertSame(parent, ns.getResolveParent());
        // Using getName we should have null
        assertNull(ns.getName());
View Full Code Here

    /*
     * NamedStyle(Style)
     */
    public void testNamedStyleStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle();
        parent.addAttribute("key", "value");
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(parent);
        assertEquals(parent, ns.getResolveParent());
        assertEquals(1, ns.getAttributeCount());
        assertEquals("value", ns.getAttribute("key"));
    }
View Full Code Here

    /*
     * NamedStyle(String, Style)
     */
    public void testNamedStyleStringStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle();
        parent.addAttribute("key", "value");
        String name = "style_name";
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(name, parent);
        assertEquals(parent, ns.getResolveParent());
        assertEquals(name, ns.getName());
    }
View Full Code Here

    /*
     * NamedStyle(String, Style)
     */
    public void testNamedStyleStringNullStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle("parentName", null);
        parent.addAttribute("key", "value");
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(null, parent);
        assertEquals(parent, ns.getResolveParent());
        assertSame(parent, ns.getResolveParent());
        // Using getName we should have null
        assertNull(ns.getName());
View Full Code Here

    /*
     * NamedStyle(Style)
     */
    public void testNamedStyleStyle() {
        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle();
        parent.addAttribute("key", "value");
        ns = StyleContext.getDefaultStyleContext().new NamedStyle(parent);
        assertEquals(parent, ns.getResolveParent());
        assertEquals(1, ns.getAttributeCount());
        assertEquals("value", ns.getAttribute("key"));
    }
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.