🌐
GeeksforGeeks
geeksforgeeks.org › java › java-awt-tutorial
Java AWT Tutorial - GeeksforGeeks
1 week ago - Learn the basics of the Abstract Window Toolkit (AWT) in Java, for both beginners and experienced developers.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › awt › package-summary.html
java.awt (Java Platform SE 8 )
2 weeks ago - Java™ Platform Standard Ed. 8 ... Contains all of the classes for creating user interfaces and for painting graphics and images. ... Contains all of the classes for creating user interfaces and for painting graphics and images. A user interface object such as a button or a scrollbar is called, ...
Discussions

AWT, SWING toolkit for java
Hello All, Which package in Manjaro gives java development toolkits like AWT and SWING ? I need to compile a small serialcomm application downloaded from net. I have no java IDE installed. In openSUSE, swing toolkit is provided by ‘swingx’ package. I cannot find it in Manjaro. More on forum.manjaro.org
🌐 forum.manjaro.org
1
0
February 28, 2025
java - What is the difference between Swing and AWT? - Stack Overflow
Can someone please explain me what's the difference between Swing and AWT? Are there any cases where AWT is more useful/advised to use than swing or vice-versa? More on stackoverflow.com
🌐 stackoverflow.com
Java AWT and Swing
He does if you watch carefully. Swing jpanel inherits setLayout from java.awt.Component, which takes java.awt.LayoutManager as a parameter, one of classes that implements that is java.awt.GridLayout, there is no swing GrindLayout, at least not directly by that name. You often use some awt components mixed in with swing. edit: side note/rant what kind of a trash tutorial doesn't provide actual source code in link, instead you have to sit through this slow paced video and pause and/or rewind/forward if you happen to miss something. More on reddit.com
🌐 r/learnprogramming
6
1
November 29, 2022
Is it possible to make a decent video game in Java awt?
Sure. Back in the late 90s, Java was Flash's biggest contributor for games on the Internet- there was a plugin that allowed you to embed Java programs using Java.awt.Applet into a webpage. Hasn't been used much since then and the plug-in no longer works, but you can do all the same stuff in a Frame and make it a standalone app. Don't expect to make the next AAA title in AWT, but you can absolutely do the same sort of stuff that was common in Flash games. More on reddit.com
🌐 r/learnprogramming
5
2
March 7, 2021
standard Java library for graphical user interfaces, succeeded by Swing
Abstract Window Toolkit - Wikipedia
The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Abstract_Window_Toolkit
Abstract Window Toolkit - Wikipedia
3 weeks ago - The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › guides › awt
Abstract Window Toolkit (AWT)
2 weeks ago - Java SE 8 Documentation · Search · The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: A set of native user interface components · A robust event-handling model · Graphics and imaging tools, including shape, color, and font classes ·
🌐
TutorialsPoint
tutorialspoint.com › awt › index.htm
AWT Tutorial
AWT stands for Abstract Window Toolkit. It is an initial toolkit library provided by Java to create a Graphical User Interface. This tutorial is designed for Software Professionals who are willing to learn JAVA GUI Programming in simple and easy
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › awt › Component.html
Component (Java Platform SE 8 )
2 weeks ago - Due to the asynchronous nature of native event handling, this method can return outdated values (for instance, after several calls of setLocation() in rapid succession). For this reason, the recommended method of obtaining a component's position is within java.awt.event.ComponentListener.componentMoved(), which is called after the operating system has finished moving the component.
Find elsewhere
🌐
BeginnersBook
beginnersbook.com › 2015 › 06 › java-awt-tutorial
Java AWT tutorial for beginners
September 11, 2022 - AWT stands for Abstract Window Toolkit. It is a platform dependent API for creating Graphical User Interface (GUI) for java programs.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-awt-toolkit
Java AWT Toolkit - GeeksforGeeks
April 28, 2025 - The Abstract Window Toolkit (AWT) is a Java package that provides a platform-indepеndеnt sеt of tools for creating graphical usеr intеrfacеs (GUIs). AWT is part of thе Java Foundation Classеs (JFC), which also includes Swing for morе ...
🌐
OpenJDK
openjdk.org › groups › awt
AWT Group
The AWT (Abstract Window Toolkit) provides an interface between a Java application and a native windowing system. AWT comprises the event handling system as well as a set of so-called heavyweight GUI components, including the top-level components such as frames and dialogs.
🌐
YouTube
youtube.com › playlist
JAVA AWT TUTORIAL - YouTube
Learn everything about AWT(Abstract Window Toolkit in Java). AWT is used is create GUI-based applications in Java. In this tutorial, I have explained each co...
🌐
Hansraj College
hansrajcollege.ac.in › hCPanel › uploads › elearning › elearning_document › 8_Java_AWT_ButtonNew.pdf pdf
Java AWT
Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based applications in java.
🌐
Java Code Geeks
javacodegeeks.com › home
AWT Tutorials - Java Code Geeks
March 6, 2023 - The Abstract Window Toolkit (AWT) is Java’s original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › awt › event › package-summary.html
java.awt.event (Java Platform SE 8 )
October 20, 2025 - Provides interfaces and classes for dealing with different types of events fired by AWT components. See the java.awt.AWTEvent class for details on the AWT event model. Events are fired by event sources. An event listener registers with an event source to receive notifications about the events of a particular type.
Top answer
1 of 9
264

AWT is a Java interface to native system GUI code present in your OS. It will not work the same on every system, although it tries.

Swing is a more-or-less pure-Java GUI. It uses AWT to create an operating system window and then paints pictures of buttons, labels, text, checkboxes, etc., into that window and responds to all of your mouse-clicks, key entries, etc., deciding for itself what to do instead of letting the operating system handle it. Thus Swing is 100% portable and is the same across platforms (although it is skinnable and has a "pluggable look and feel" that can make it look more or less like how the native windows and widgets would look).

These are vastly different approaches to GUI toolkits and have a lot of consequences. A full answer to your question would try to explore all of those. :) Here are a couple:

AWT is a cross-platform interface, so even though it uses the underlying OS or native GUI toolkit for its functionality, it doesn't provide access to everything that those toolkits can do. Advanced or newer AWT widgets that might exist on one platform might not be supported on another. Features of widgets that aren't the same on every platform might not be supported, or worse, they might work differently on each platform. People used to invest lots of effort to get their AWT applications to work consistently across platforms - for instance, they may try to make calls into native code from Java.

Because AWT uses native GUI widgets, your OS knows about them and handles putting them in front of each other, etc., whereas Swing widgets are meaningless pixels within a window from your OS's point of view. Swing itself handles your widgets' layout and stacking. Mixing AWT and Swing is highly unsupported and can lead to ridiculous results, such as native buttons that obscure everything else in the dialog box in which they reside because everything else was created with Swing.

Because Swing tries to do everything possible in Java other than the very raw graphics routines provided by a native GUI window, it used to incur quite a performance penalty compared to AWT. This made Swing unfortunately slow to catch on. However, this has shrunk dramatically over the last several years due to more optimized JVMs, faster machines, and (I presume) optimization of the Swing internals. Today a Swing application can run fast enough to be serviceable or even zippy, and almost indistinguishable from an application using native widgets. Some will say it took far too long to get to this point, but most will say that it is well worth it.

Finally, you might also want to check out SWT (the GUI toolkit used for Eclipse, and an alternative to both AWT and Swing), which is somewhat of a return to the AWT idea of accessing native Widgets through Java.

2 of 9
38

The base difference that which already everyone mentioned is that one is heavy weight and other is light weight. Let me explain, basically what the term heavy weight means is that when you're using the awt components the native code used for getting the view component is generated by the Operating System, thats why it the look and feel changes from OS to OS. Where as in swing components its the responsibility of JVM to generate the view for the components. Another statement which i saw is that swing is MVC based and awt is not.

🌐
Reddit
reddit.com › r/learnprogramming › java awt and swing
r/learnprogramming on Reddit: Java AWT and Swing
November 29, 2022 -

I am following this tutorial Java GUI Tutorial - Make a GUI in 13 Minutes - YouTube to create a simple GUI. I have already read that AWT is heavyweight and it is wiser to use Swing as it is lightweight. My understanding (correct me if I am wrong) is that AWT GUI will reflect the OS on which you are running the code, with Swing it will not. As well as that Swing allows for more advanced GUI capabilities. I remember reading that JComponent inherits from Component (which is within the AWT package).

Anyways, I am following this tutorial and when I attempt to write

panel.setLayout(new GridLayout(0, 1));

GridLayout is turning red and IntelliJ advises me to import the java.awt.* package. But in the video, I cannot see that he has had to import AWT to use that. He only seems to be using Swing.

My question is, do I have to use AWT package at some point when creating a Swing GUI? If so, why is that and where is it okay to use it? If not, what could I potentially have missed? Thank you for reading :)

🌐
Lehigh
cse.lehigh.edu › ~glennb › oose › java › javaawt.htm
Java AWT tutorial
The Java Abstract Window Toolkit provides a cross-platform library which seeks to observe look-and-feel conventions of various OS platforms. Toolkit --------------------------------------------------------- AWT --------|--------- Button List JVM ------|-------------|-----------------------...
🌐
MIT
web.mit.edu › java_v1.0.2 › www › javadoc › Package-java.awt.html
Package java.awt
All Packages Class Hierarchy Index · package java.awt · LayoutManager · MenuContainer · BorderLayout · Button · Canvas · CardLayout · Checkbox · CheckboxGroup
🌐
Studytonight
studytonight.com › java › java-awt.php
AWT in Java GUI | Studytonight
Java AWT is an API that contains large number of classes and methods to create and manage graphical user interface ( GUI ) applications. The AWT was designed to provide a common set of tools for GUI design that could work on a variety of platforms. The tools provided by the AWT are implemented ...