What are two key features of Swing?
Two KEY FEATURES OF SWING
As already mentioned Swing was created to address the limitations present in the AWT. It does this through two key features: lightweight components and a pluggable look and feel.
Swing Components are Lightweight: Except few exceptions, swing components are lightweight. This means that they are written entirely in Java and do not map directly to platform-specific equivalents or peers. Lightweight components are rendered using graphics primitives. Thus they can be transparent, which enables nonrectangular shapes. Thus, lightweight components are more efficient and more flexible. Furthermore, because lightweight components do not translate into native peers, the look and feel of each component is determined by Swing, not by the underlying operating system. This means that each component will work in a consistent manner across all platforms.
Swing Supports a Pluggable Look and Feel: Swing supports a pluggable look and feel (PLAF). Because each Swing component is rendered by Java code rather than by native peers, the look and feel of a component is under the control of Swing. Thus, it is possible to separate the look and feel of a component from the logic of the component, and this is what Swing does. Separating out the look and feel provides a significant advantage: It is possible to "Plugin" a new look and feel for any given component without creating any side effects in the code that uses that component. Pluggable look-and-feel offer several important advantages.
- It is possible to define a look and feel that is consistent across all platforms.
- It is also possible to design a custom look and feel.
- The look and feel can be changed dynamically at run time.
Comments
Post a Comment