• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fundamentals: AWT vs Swing

 
Chris Crawford
Ranch Hand
Posts: 96
Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got one of those big questions that you never think about except at the outset of a project. I realized that, for my current project, I really don't want any kind of resizing or moving around of components in the JFrame. For complicated reasons, I just need to have everything in a set place, without any changes in position because something new is a bit bigger or smaller. I've done a halfway decent job of getting Swing to do that, but it occurred to me that the whole design philosophy behind Swing may have been to provide easily resizable windows -- and if that is true, then an application that doesn't tolerate window resizing would be better off using AWT, right?

My application is close to complete, but now I'm fighting all those pesky little repositionings that Swing loves to do. Would I be better off just stripping the leading J from all those components?
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris Crawford wrote:..., but it occurred to me that the whole design philosophy behind Swing may have been to provide easily resizable windows -- and if that is true, then an application that doesn't tolerate window resizing would be better off using AWT, right?

Not really.
AWT relies on the underlying OS for component "peers" where as Swing provides its own.
Imagine a button. Whenever the UI needs to render a button, AWT will ask the OS "give me a button to render". On the other hand, Swing will render the button itself.
This article will be an interesting read.
If you can share more information on what you are exactly trying to achieve, we can help you better.

In the meanwhile, I will move this thread over to the UI forums.
 
Chris Crawford
Ranch Hand
Posts: 96
Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clearing that up for me. Sometimes the fundamentals are difficult to figure out because nobody mentions them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic