Is swing purely Java?

I had an argument with my friend on Swing and it's platform independence. My friends argument was that, swing cannot be platform independent if one of it's parent classes has a native method.

For eg: JLabel extends JComponent extends Container extends Component

And Component has a native method, and hence swing can't be purely Java? Even I am confused? Can someone explain?

[397 byte] By [sri1025a] at [2007-10-3 3:22:56]
# 1
The implementation of Swing is native (think about events, painting and so on), but the API that is exposed to the applications is pure Java. When *you* write a Swing program, it's 100% Java. When it *runs*, it uses native OS resources and calls.
kirillga at 2007-7-14 21:15:23 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi,

as far as I understood it (but I might be wrong) the difference between AWT and Swing is the following (among others):

With AWT there are native calls to draw the components, eg. the OS says how to draw a button. These are known as heavyweight components.

With Swing all components are drawn with Java (except some Windows). These are known as lightweight components. (This also allows the concept of the pluggable L&F.)

Yes, Swing components do extend AWT components, but I think that some methods are overriden or there are some switches or something like this, to avoid those native calls.

-Puce

Pucea at 2007-7-14 21:15:23 > top of Java-index,Desktop,Core GUI APIs...
# 3

While AWT components are drawn using native widgets and Swing components is drawn using Java2D code (unless we're talking about "native" LAFs such as GTK / Windows), eventually Java2D implementation goes to the native code. So, it's all a question of how deep you go into the Java stack until you go native.

kirillga at 2007-7-14 21:15:23 > top of Java-index,Desktop,Core GUI APIs...