With the 2D graphics API, you can create all kinds of shapes using the package and the Shape interface. The Java 2D API is the natural evolution of the drawing part of the AWT toolkit. The Java 2D API includes all kinds of functionality to support 2D graphics on the Java platform: including all the support for colors, fonts, geometry, graphics, painting, imaging, and printing. Swing also comes with its own pluggable look and feel framework, so that you can change how Swing components look. This certainly comes in handy when you want to quickly add rich text to Swing programs. Just include a well formed HTML document in your JLabels. Swing is also notable by the fact that you can use HTML and CSS in Swing components.
![java desktop frame java desktop frame](https://i2.wp.com/resumekraft.com/wp-content/uploads/2019/12/hr-internship-resume-example.jpg)
Swing components include labels, button, checkboxes, lists, menus, radio buttons, sliders, spinners, text fields, text areas, editor panes, progress bars, trees, tables, and color panes among others. It builds upon AWT, but it provides a wide variety of original functionality and many new widgets. If you want to actually build a graphical user interface application using Java SE, you are going to be using Swing. A JFrame for example extends from the AWT classes Frame and Window. Aside from the Component and Container classes, the various Window classes of AWT are inherited by Swing. Container describes the interface to the AWT layout managers, which again are reused with Swing. The Component class defines the interface from widgets to the AWT event model, which is also still used by Swing. The Component and Container class provide a couple hundred methods dealing with a wide variety of purposes like event handling, grouping and layout, resizing, colouring, painting, fonts, and so on. The main way that AWT does this is through the Component and Container classes which all Swing components extend from. The main role of AWT now is to be a building block for Swing. The AWT was the first widget toolkit released for Java. By combining rich graphics built with the Java 2D API and the event model, any kind of interactive GUI program can be built with Java.
![java desktop frame java desktop frame](https://m.media-amazon.com/images/I/81FLCJ+utHL._AC_US800_.jpg)
As Swing is built on the building blocks of AWT, it uses the same event model as AWT. In this model, applications add one more listeners to the events to a given component. In order to support interactive applications Java SE desktop applications use the Java 1.1 event model. However, media applications don't include interactivity which is the role of the user interface framework. These are provided by the 2D graphics API and the sound API.
![java desktop frame java desktop frame](https://dz7xwpjzpkel8.cloudfront.net/production/7666-1-original.jpg)
These are the basic building blocks of all media applications. The basic media functionality that a program for desktop computers needs to support are 2D graphics and sound. The UI framework evolved into Swing and the media subsystem evolved into Java 2D and eventually Java Sound. Conceptually, the AWT can be be broken down in to two components: the user interface component and the media subsystem. The module has four major components:Īside from these components, there are several minor components like accessibility, drag and drop, and java beans. With the modularization of the JDK, all the functionality that grew around AWT was moved into the desktop module. The java desktop module is the modern evolution of the abstract window toolkit (AWT) released with the first version of Java.