
|
|
Magercises:
AWT Basics
Introduction
These Magercises show how to use Java's Abstract
Window Toolkit components to interact with Java forms and
windows.
There are eight Magercises to complete:
- Drawing a stick
figure
Using the Graphics methods, draw a stick
figure. Educational goal(s):
- Learn how to draw with the Java Graphics
class.
- Colored Panes
Create a colored Canvas class. We have
provided a simple test that draws a 2x2 grid of
colored canvases. Educational goal(s):
- Learn how to use a Canvas.
- Font list
Display a sample of all fonts available to Java
in 16 point bold. Educational goal(s):
- Learn how to use Toolkit.
- Learn how to work with Font.
- Learn how to use FontMetrics.
- Compass Points
(using VCE)
Add buttons at all points of the compass and the
center position of a BorderLayout. Educational
goal(s):
- Learn about the BorderLayout
layout manager.
- Phone Dialing
Keypad (using VCE)
Create a phone keypad full of buttons layed out
with GridLayout. Educational goal(s):
- Learn about the GridLayout
layout manager.
- Flipping through
components (using VCE)
Create a set of "cards" with an AWT
component on each one, laying them out with CardLayout.
Use a modified version of the phone keypad to
flip through the components. Educational
goal(s):
- Learn about the CardLayout
layout manager.
- Absolute layout
(using VCE)
While many GUIs can be laid out using the
flexible layout managers, it is often the case
that you simply want to lay out your components
in fixed positions and sizes. This Magercise asks
you to lay out a number of components this way. Educational
goal(s):
- Learn about using no layout manager.
|