Java GUI listeners without AWT

There have been some good answers, but I would like to cover a slightly different aspect. Things that Swing provides beyond AWT.


Swing supports styled documents in JEditorPane & JTextPane & to a limited extent using HTML in some other JComponents. AWT does not support styled documents in any component.

AWT provides no tree based structure like JTree, no tabular structure such as JTable, no version of JToolBar.

AWT has no equivalent (that I can find or recall) for JColorChooser & none for the simple utility class – JOptionPane.


As mentioned in a comment, see the 20+ extra/alternate listeners in the javax.swing.event package.

Pluggable Look & Feel

Swing components can be set to a particular look & feel at run-time, including a native PLAF.

See the screen shots on the Nested Layout Example for some more samples.


In addition to the plethora of AWT layouts, Swing provides:

  1. BoxLayout
  2. GroupLayout
  3. OverlayLayout
  4. ScrollPaneLayout
  5. SpringLayout
  6. ViewportLayout


  • Key Bindings. See How to Use Key Bindings for details.
  • UndoManager for undo/redo ability in editable documents.
  • Inbuilt double buffering to avoid flicker on repaint.
  • SwingWorker for responsive GUIs.

There is probably a lot more I missed in that brief description, but the bottom line is that Swing is an altogether newer and more enabled GUI toolkit.

Swing both builds on, and relies heavily on, classes in the AWT.

Leave a Comment