Java started with awt (Abstract Windowing Toolkit), and swing was later introduced.
In AWT , the platform event processing loop is connected, and the events are packaged in native Java classes, and one (non-parallel) event processing queue / thread processes them one by one. Swing inherits this.
In AWT, each GUI component, such as a radio button or menu item, has its own βpeer-to-peerβ control, a component provided by the platform. There is a parallel set of java classes and their counterpart C. The java Graphics class is especially interesting, which allows you to customize the drawing of lines, rectangles, etc. It is viewed under Windows with CDC (Device Context) - presumably.
In Swing, most of the platform components are emulated, that is, recreated themselves: drawing, mouse processing, etc. Thus, the native part is simpler, say, CWnd (Window component) with a custom drawing.
Swing can provide more consistent and feature rich functionality. You might imagine that setting the backgroud color on the AWT radio button might not be possible or using HTML on a label or tooltip. Also Swing can do skinning, themes, LookAndFeels. The system looks and feels like a close imitation of platform components. Especially Swing components are more light weight , since not every component has its own peer control, which must be processed in C.
Now, SWT is a later IBM initiative implemented in eclipse to reload AWT. Not as customizable as Swing, but designed for the platform nearby.
You should forget to use AWT components, and if you do not program for Eclipse RCP as SWT as well.
So: global platform events, such as mouse clicks, redraw requests, are translated into Java events. There is a hierarchy of containers JFrame, JPanels, JScrollPanes, JComponents. The event is dispatched to processing components, for which, for example, is called paintComponent:
@Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g;
With JavaFX , a new player appears that IMHO is not yet fully mature, but can be used in non-production code. It allows you to create effects / animations, rotations, transformations, lights. Thus, 2D-4D rendering based on a similar rendering platform. This property is also based, so the flag does not have to be tied to a logical but Boolean property that observes and notifies changes. I need some more practical experience to imagine the optimal architecture.