Java AWT
From DocForge
Java's Abstract Windowing Toolkit (AWT) library is an extremely lightweight, cross platform GUI toolkit. AWT defines many GUI behaviors which both Swing and SWT borrow from, primarily the event multicasting systems. AWT is usually not used unless the rendering methods are being overridden, because AWT's look'n'feel is positively hideous. Those not intending to write their own, custom-designed GUI are probably seeking Java's Swing toolkit.
[edit] Efficiency in AWT Event Handling
Generally, the common technique for responding to events is to subclass an Adapter, override the necessary function. Here's an example using an inner class:
Frame myFrame = new Frame("SomeTitle"); myFrame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } });
This is a generally acceptable way to do this if you wish to have a number of simple event responses, but a better route (again using Frame as an example — most AWT UI classes feature the following method) is to simply override the event dispatcher for that kind of method, i.e.:
public class MyFrame extends Frame { public MyFrame(){ enableEvents(AWTEvent.WINDOW_EVENT_MASK); } protected void processWindowEvent(WindowEvent e){ if(e.getID() == WindowEvent.WINDOW_CLOSING){ System.exit(0); } } }
This has the benefits of reducing class overhead, as well as preventing the Frame from instantianting AWTEventMulticaster.

