Mixing Swing with AWT... why not?
Posted on 2002-03-06
I have read in this forum that it is bad to mix Swing with AWT, but I don't understand why. I have read that Swing uses 'heavyweight' components while AWT uses 'lightweight' components, but I don't understand what that means.
What is a 'heavyweight' component and what is a 'lightweiget' component?
Since all the Swing classes extend AWT classes, if AWT classes are 'heavyweight', how can the subclasses be 'lightweight'? When you cast a Swing class to its AWT superclass, you lose functionality, so how is the Swing class 'lighter'?
And since the Swing classes extend AWT classes, you can say that a Swing class IS an AWT class.
Are there any other reasons to not mix them? I've done it and it seems to work just fine.
What do I buy by limiting my component selection to one group or the other?