Distinguishing between UI-set and app-set properties
by, 04-26-2012 at 08:44 PM (547 Views)
Swing. Therefore this would be a critical thing to ensure that values donít clobber when componentís default properties are set up by Look and Feel, for the component.
This issue doesnít arise when UI delegate first time is installed, at the component as properties are uninitialized and ultimately would be settled legally by Look&Feel. When individual properties are set after construction of component & subsequently new setup of Look and Feel takes place, such problem arises. Hence, it shall be possible for Look and Fell to differentiate b/w property values which have been set by look&Feel and, those set by application.
This issue is handled by marking all values set by the look-and-feel with the plaf.UIResource interface. The plaf package provides a set of "marked" classes for representing these values, ColorUIResource, FontUIResource, and BorderUIResource. The preceding code example shows the usage of these classes to mark the default property values for the hypothetical MyButtonUI class.
Mark all values which have been set by Look and Feel to handle this situation, with interface plaf.UIResource. Market classes set is provided by plaf package to present these values, BorderUIResource, FontUIResource, and ColorUIResource.