Does rendering into AWT cause extra overhead?

Hi there!

I am using a pure java toolkit (not swing) which still renders for compatibility to 1.1-jvms all the lightweight stuff into an AWT-Frame (actually it renders into a AWT-Panel is added to the Frame).

For me it would be interresting how much overhead this causes in modern JVMs, since I think the JRE has to do some extra stuff to be compatible or that it cant accerlate AWT-heaviweight components not as good as leightweight ones.

Here are my questions g :

  • Does this cause any overhead?
  • Would it help to add the AWT-Panel to a JFrame insteadof Frame?
  • Does one AWT component slow down the whole rendering pipeline?

Thanks in advance, lg Clemens

IF you will use AWT, you should ONLY use AWT, otherwise you won’t be compatible with 1.1 anymore.

There will be no performance degradation, that I know of, AWT uses native (the platform’s own) widgets, so they should at least be rendered fast.

The problem with AWT is that it represents the least common denominator between all platforms and it is hard to customize components.

I would definitely do everything to stay away from AWT, but that’s just me… :slight_smile:

Why do you need 1.1 compatibility?

Cheers,
Mikael Grev

Hi!

Thanks for your answer!

1.) I ment drawing performance. I use a lightweight library called lwvcl (see www.lwvcl.com ) which is quite fast, small and powerful.
It can be compared to swing, except it does not inherit from java.awt.Component that makes it so slim.
I already tried to do it with “native”-AWT, however implementations were so buggy (msjvm, netscape…) that it was not possible withought a HUGE amount of time.

So native widget performance does me not bother at all, the reason why I was asking was to know wheter rendering Java2D into “pure” AWT-Components causes some overhead because lets say its not possible to render into D3D anymore, because it could be that native widgets sould be used.
Do you know anything about this issue?

2.) My boss wants that my applet runs in msjvm and netscape-4.7+. msjvm is really ugly, however netscape performs well on old computers.

lg Clemens

Sorry, my knowledge about native rentering and customizing AWT is i bit too limited to answer that. :-/

SWING - Lightweight
AWT = Heavyweight

This is according to Sun’s tutorial.

You should stay away from AWT as memory overhead would be slightly larger than SWING’s. This is regardless of the purpose you are using it for.

Hmm, it seems I am asking at the wrong place.

java.awt.Component -> AWT -> even lightweight
javax.swing.JFrame -> SWING -> heavyweight

Nevermind, thanks for trying to help me.

lg Clemens

“If you use lightweight components, such as Swing components, you may have to fiddle with them a bit so that they draw using your Graphics, and not directly as a result of calling the paint method. Feel free to call Swing methods such as paintComponents, paintComponent, paintBorder, and paintChildren directly from your rendering loop.”

http://java.sun.com/docs/books/tutorial/extra/fullscreen/rendering.html

If you use Swing, you are using lightweight components.

Hmmmmm :-/

Lightweight means that the component has no native peer at all.
So a JFrame is not lightweight because it needs to create such a peer, to communicate with the window-manager that it now needs a window and so on.

A JButton is leightweight, the button only paints itself into a graphics-instance provided by anything heavyweight (e.g. the JFrame).

lg Clemens