正在加载图片...
Swing vs AWT When Java was introduced, the gui classes were bundled in a library known as the abstract Windows Toolkit(AWt). For every platform on which Java runs, the awT components are automatically mapped to the platform-specific components through their respective agents, known as peers. AWT is fine for developing simple graphical user interfaces, but not for developing comprehensive GuI projects O AWT is prone to platform-specific bugs because its peer-based approach relies heavily on the underlying platform Swing components are painted directly on canvases using Java code except for components that are subclasses of java. awt. Window or java.awt. Panel, which must be drawn using native gui on a specific platform Swing components are less dependent on the target platform and use less of the native gui resource o For this reason, Swing components that don' t rely on native GUI are referred to as lightweight components, and awT components are referred to as heavyweight components Liang, Introduction to Java Programming, revised by Dai-kaiyuLiang,Introduction to Java Programming,revised by Dai-kaiyu 6 Swing vs. AWT ⚫When Java was introduced, the GUI classes were bundled in a library known as the Abstract Windows Toolkit (AWT). For every platform on which Java runs, the AWT components are automatically mapped to the platform-specific components through their respective agents, known as peers. ⚫AWT is fine for developing simple graphical user interfaces, but not for developing comprehensive GUI projects. ⚫AWT is prone to platform-specific bugs because its peer-based approach relies heavily on the underlying platform. ⚫ Swing components are painted directly on canvases using Java code, except for components that are subclasses of java.awt.Window or java.awt.Panel, which must be drawn using native GUI on a specific platform. ⚫Swing components are less dependent on the target platform and use less of the native GUI resource. ⚫For this reason, Swing components that don’t rely on native GUI are referred to as lightweight components, and AWT components are referred to as heavyweight components
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有