Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Swing (Java)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Relationship to AWT=== [[File:AWTSwingClassHierarchy.png|thumb|AWT and Swing class hierarchy]] Since early versions of Java, a portion of the [[Abstract Window Toolkit]] (AWT) has provided platform-independent APIs for user interface components. In AWT, each component is rendered and controlled by a native peer component specific to the underlying windowing system. By contrast, Swing components are often described as ''lightweight'' because they do not require allocation of native resources in the operating system's windowing toolkit. The AWT components are referred to as ''heavyweight components''.<ref>{{cite web |last1=Zakhour |first1=Sharon |last2=Petrov |first2=Anthony |date=April 2010 |df=mdy |url=https://www.oracle.com/technical-resources/articles/java/mixing-components.html |title=Mixing Heavyweight and Lightweight Components |publisher=[[Oracle Corporation|Oracle]] |access-date=2020-07-26}}</ref> Much of the Swing API is generally a complementary extension of the AWT rather than a direct replacement. In fact, every Swing lightweight interface ultimately exists within an AWT heavyweight component because all of the top-level components in Swing ({{Javadoc|module=java.desktop|package=javax/swing|class=JApplet|text=JApplet|monotype=y}}, {{Javadoc|module=java.desktop|package=javax.swing|class=JDialog|text=JDialog|monotype=y}}, {{Javadoc|module=java.desktop|package=javax.swing|class=JFrame|text=JFrame|monotype=y}}, and {{Javadoc|module=java.desktop|package=javax.swing|class=JWindow|text=JWindow|monotype=y}}) extend an AWT top-level container. Prior to [[Java version history#Java SE 6|Java 6 Update 10]], the use of both lightweight and heavyweight components within the same window was generally discouraged due to [[Z-order]] incompatibilities. However, later versions of Java have fixed these issues, and both Swing and AWT components can now be used in one GUI without Z-order issues. The core rendering functionality used by Swing to draw its lightweight components is provided by [[Java 2D]], another part of JFC. {{Off topic|date=May 2012}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)