Swing
Re: A Dumb Swing
Date: Tue, 6 May 2003 12:09:30 -0600Newsgroups: comp.lang.java.programmer
Size: 1,663 bytes
I'll answer a bit differently from Daniel. Not that Daniel is wrong, but there is more detail worth mentioning. Michael wrote: > 1) is swing built on awt? > Swing is built on top of the base GUI framework defined by the AWT. The most fundamental pieces of AWT continue on into the Swing framework. However, the AWT is also a collection of native widgets (TextField, etc). These native widgets are not carried over into Swing. So, Swing depends on things like Window, Frame, KeyEvent, and Toolkit, but that's only a subset of the AWT. You should also be aware that Swing provides better ways to handle certain ways of doing things from the AWT. Thus, even though Swing as a library builds on KeyListener, for example, it's frequently a very bad practice to use KeyListener in a Swing control. ActionMap and InputMap provide better abstractions for most uses of keys in GUI components. > 2) does swing replace color and font from awt? > No. > 3) is a frame a top-level container? i know a JFrame is. > Yes. However, it's not a top-level Swing container. So, for example, a lot of Swing books will say something like "all top-level containers have a method called getContentPane()" and "you should not add components directly to a top-level container". Those statements are aimed specifically at Swing top-level containers (JFrame, JWindow, JDialog, and JApplet), and should not be applied to the AWT top-level containers. So watch out, there. It depends on the usage of the term. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation
