Magercises: AWT Review


Introduction

These Magercises provide some review of basic AWT programming.

There are seven Magercises to complete:

  1. Drawing a stick figure
    Using the Graphics methods, draw a stick figure.

    Educational goal(s):

    • Learn how to draw with the Java Graphics class.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.


Copyright © 1996-1997 MageLang Institute. All Rights Reserved.