Web design rates - Java Swing - O Reilly Before looking at the
Java Swing - O Reilly Before looking at the methods related to managing Style objects, we’ll take a quick detour to look at how the StyleContext manages Styles internally. Figure 21.3 shows an object structure for a StyleContext containing two Styles, each of which has a single “real” attribute, along with its name and resolving parent, stored as attributes of the Style (if they are non-null). There are two things to note about this structure. First, the StyleContext actually uses a Style object to manage Styles. The attribute keys in this special Style are the names of the real Styles. In our example, there are two Styles named style1 and style2 (the resolving parent of style2 is a third Style object that is not shown). The values for these keys are Style objects. Second, the NamedStyle inner class (described in a few pages) actually uses a SimpleAttributeSet to store attribute values. Figure 21.3. Inside a StyleContext 21.1.5.7 Style Management Methods The following methods are used to create new Styles and manage them using a StyleContext: public Style addStyle(String nm, Style parent) Creates a new, empty Style with the specified name and resolving parent. If no name is specified, the new Style will not be managed by the StyleContext, so the caller is responsible for keeping track of it. The second argument should be null if there is no parent for this Style (a common case). It is helpful to understand that this method returns a new StyleContext.NamedStyle (which implements Style). This inner class uses the attribute management methods defined in the last section to keep track of the attributes that define the Style. This means that attributes directly added to the Style object will automatically be incorporated into the StyleContext, without requiring an explicit call to StyleContent.addAttribute(). public Style getStyle(String nm) Returns a Style for the given name. If no Style has been added with the specified name, it returns null. public void removeStyle(String nm) - 709
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.