How portable is Swing vs AWT Do I get the same degree of GUI portability with Swing than with AWT?.

Luigi Viggiano

Yes Swing is platform independent, and applications will render in the same way in different OS. Also your application can change "skin" to get nicer, also at runtime and will render in the same way in Linux, in Windows an so on...

Using AWT your application will mantain the same behaviour and the same "layout" but controls will render using the control set of host platform, then will be slightly different changing platform.

The reason why AWT is used, for example in applets, is that rendering and handling requires fewer downloaded classes because is managed by client/browser environment (the jar containing Swing extensions is a little big). AWT is supported by all the browsers Java enabled (java.awt is a core API).

Summarizing, and answering your 1st question, we can say that with Swing also appearance is portable.

About the 2nd question, Swing is dependent from AWT because there are some classes in Swing extending, wrapping, and using classes from AWT package, then there's a deep dependency between AWT and Swing.