• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does Swing allows Java programmers to ignore the package Abstract Windowing Toolkit (AWT)?

 
kenny gill
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm being asked to answer this but I'm not why Swing allows a programmer to ignore the AWT.
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AWT was the original GUI package of Java. It took the approach of putting wrappers around the native GUI widgets of whatever OS the Java application was running on. This approach had some problems. The native widgets could be different sizes and shapes on different OSes, so it was hard to Write Once Run Everywhere without Testing Everywhere to see if the widgets laid out right on each platform. Also, a similar widget might have different capabilities on different OSes, so AWT could only use features that were common across all the OSes.

To answer these issues, Java introduced a completely different GUI package, and that's Swing. Swing created painted its own widgets, so it has a lot more flexibility than AWT. On the other hand, it has performance issues as can be a bit clunky to use, especially for a beginner. The Swing widgets replace the AWT widgets. While it's not entirely impossible to combine the two, I remember that causing some rendering problems, like buttons appear underneath their panel. Mostly if you use Swing, you stick entirely to the Swing components and don't use the AWT ones at all. There are a few AWT classes that still get used though, like java.awt.Color.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic