In the above figure, there are three containers: a Frame and two Panels. A container can also hold sub-containers. Container: Containers, such as Frame and Panel, are used to hold components in a specific layout (such as FlowLayout or GridLayout).They are also called widgets, controls in other graphics systems. Component ( Widget, Control): Components are elementary GUI entities, such as Button, Label, and TextField.Event Listener Adapter classes, such as MouseAdapter, KeyAdapter, and WindowAdapter.ĪWT provides a platform-independent and device-independent interface to develop graphic programs that runs on all platforms, including Windows, macOS, and Unixes.Event Listener Interfaces, such as ActionListener, MouseListener, MouseMotionListener, KeyListener and WindowListener,.Event classes, such as ActionEvent, MouseEvent, KeyEvent and WindowEvent,.Custom graphics classes, such as Graphics, Color and Font.Layout managers, such as FlowLayout, BorderLayout and GridLayout.
Other than AWT/Swing/JavaFX graphics APIs provided in JDK, other organizations/vendors have also provided graphics APIs that work with Java, such as Eclipse's Standard Widget Toolkit (SWT) (used in Eclipse), Google Web Toolkit (GWT) (used in Android), 3D Graphics API such as Java bindings for OpenGL (JOGL), Java3D, and etc. JavaFX was moved out from the JDK in JDK 11, but still available as a separate module. The latest JavaFX, which was integrated into JDK 8, was meant to replace Swing.
JFC has been integrated into core Java since JDK 1.2. JFC consists of Swing, Java2D, Accessibility, Internationalization, and Pluggable Look-and-Feel Support APIs.
Writing your own graphics classes (and re-inventing the wheels) is mission impossible! These graphics classes, developed by expert programmers, are highly complex and involve many advanced design patterns. In this article, I shall show you how you can reuse the graphics classes provided in JDK for constructing your own Graphical User Interface (GUI) applications. These classes are self-contained and are reusable. You can create high-level abstract data types called classes to mimic real-life things. As discussed, OOP permits higher level of abstraction than traditional Procedural-Oriented Languages (such as C). So far, we have covered the basic programming constructs (such as variables, data types, decision, loop, array and method) and introduced the important concept of Object-Oriented Programming (OOP).