Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TreizeSG

[java] Swing vs. AWT

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I have an AWT component, for example a Frame, can I have it possess a Swing component, for example, a JTabbedPane? Even if I can, is it a good/bad idea?

Share this post


Link to post
Share on other sites
Advertisement
A Frame can contain JComponents, but it''s not a sound design. Can''t you use a JFrame?



"Yeah, I would''ve killed you, but I''m glad I didn''t - the paperwork is a bitch"

Share this post


Link to post
Share on other sites
There''s no need to mix the two. After all, Swing was developed as a replacement for AWT (though as I understand it, it''s actually built on top of it). It would therefore make more sense to have, say, a JFrame, and AWT components in that, but it''s still highly inadvisable and, as far as I could tell, pointless.

The Artist Formerly Known as CmndrM

http://chaos.webhop.org

Share this post


Link to post
Share on other sites
google's a good thing

http://java.sun.com/products/jfc/tsc/articles/mixing/

Most AWT components are "heavyweight", most Swing components are "lightweight". That article talks about mixing light and heavy components together and why it's bad.

Yeah, Swing essentially extends AWT. Swing depends on AWT heavily.

AWT is usually a bit faster but is much more limited. If you're making a game and the only piece of AWT you need is a window, then use Frame instead of JFrame for instance. Just that tiny change to my program caused a noticable framerate difference when I was using Java2D.

Despite what Sun will tell you, Swing's pretty bloated. It can take a bit of work to keep an app that uses a lot of Swing as responsive as a native equivalent (just look at how laggy NetBeans is).



[edited by - tortoise on August 18, 2003 1:35:35 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!