Presentation is loading. Please wait.

Presentation is loading. Please wait.

The AWT (versus Swing Components)

Similar presentations


Presentation on theme: "The AWT (versus Swing Components)"— Presentation transcript:

1 The AWT (versus Swing Components)
CS 21b

2 The AWT AWT: Abstract Windowing Toolkit
Alternative way of designing GUIs in Java The toolkit patterns its look and feel with the operating system you are using In contrast, swing components (javax.swing.*) results in the same look and feel regardless of operating system © Luis F. G. Sarmenta and John Paul Vergara, Ateneo de Manila University Overview Slide 2

3 AWT Components The same components (present in swing) are available
Just drop the starting “J” Button instead of JButton Panel instead of JPanel Applet instead of JApplet Frame instead of JFrame No need to import javax.swing.*; © Luis F. G. Sarmenta and John Paul Vergara, Ateneo de Manila University Overview Slide 3

4 Containers in the AWT Applets and Frames are themselves Containers in the AWT When using swing: Container c = this.getContentPane(); c.setLayout( … ); c.add( … ); When using the AWT, do this instead: this.setLayout( … ); this.add( … ); © Luis F. G. Sarmenta and John Paul Vergara, Ateneo de Manila University Overview Slide 4

5 Why study the AWT? Sometimes you want your Applets and Frames to follow the same GUI conventions as other Windows applications Swing has problems particularly when you combine components with Graphics (paint) Probably because Graphics is part of the AWT © Luis F. G. Sarmenta and John Paul Vergara, Ateneo de Manila University Overview Slide 5


Download ppt "The AWT (versus Swing Components)"

Similar presentations


Ads by Google