Java Swing O Reilly property, but we hesitate (Apache web server for windows)
Friday, July 27th, 2007Java Swing O Reilly property, but we hesitate to call it a property because its accessor isn’t public. Invoking setUI() by itself, however, does not change the display. A call to updateUI() is also required, which forces the component to redraw itself. If you are looking to change the entire look-and-feel of the application, it is better to change it universally with the setLookAndFeel() method of UIManager, than to change it one component at a time. See Chapter 2 for a simple example of how to work with various look-and-feels. Each Swing component maintains a read-only string constant, UIClassID , that identifies the type of UI delegate that it uses. Most Swing components override the accessor getUIClassID() and return a string constant, typically the letters “UI” appended to the name of the component (without the “J”). This string is then used by Swing’s UI manager to match the component with a UI delegate for the current look-and-feel. For example, a JButton object has a UIClassID string of ButtonUI. If the current look-and-feel is “Metal,” the UIManager can figure out that the MetalButtonUI is the correct UI-delegate class to use. See Chapter 26, for more information about the UIManager and using look-and-feels. 3.3.2.2 Invalidating and Repainting Sometimes entire components need to be drawn to the screen. At other times, only parts of components can (or should) be drawn. For example, if an internal frame is dragged across the container, the entire internal frame is redrawn along the way until it reaches its destination. However, only the parts of the container uncovered by the internal frame need to be repainted. We typically do not repaint the entire component, as this would be an unnecessary waste of processing time. (See Figure 3.4.) Figure 3.4. Performing repaints for components in Java - 56 -
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.