Assignment-03b

 

 

 

Foreword

Resources

Code Listings

Foil Sets

Assignments

Solutions

External Resources

SiteMap

Search

Home

Up ] Assignment-01a ] Assignment-01b ] Assignment-01c ] Assignment-01d ] Assignment-02 ] Assignment-02a ] Assignment-03 ] Assignment-03a ] [ Assignment-03b ] Assignment-03c ] Assignment-03d ] Assignment-04 ] Assignment-04a ] Assignment-04b ] Assignment-05 ] Assignment-06 ] Assignment-07 ]

The art and science of user interface design is an important branch of computer science. In this assignment, we will use Java's Abstract Windowing Toolkit to build a graphical user interface.

Until recently, Macintosh fonts and desk accessories were installed using a program called Font/DA Mover, a utility that copies fonts and DAs from one disk to another. Here's a screen shot of Font/DA Mover poised to copy a font from a floppy disk called "Fonts #1" to a hard disk called "Hard Disk":

As you can see, the Font/DA Mover has a complex user interface consisting of scrollable lists, pushbuttons, radio buttons, and text labels. Many of these components are dynamic, that is, as the user interacts with the controls, the text and button labels change. Moreover, when the user clicks the radio button labeled "Desk Accessory", the contents of the scrollable lists change from fonts to desk accessories:

In the above screen shot, the Font/DA Mover is ready to copy a desk accessory called "Calculator" from the hard disk to a floppy disk called "DAs".

Since the Font/DA Mover interacts with the underlying file system, it must be written as a Java application, not an applet. (Applets do not have access to the underlying file system for security reasons.) For the purposes of this assignment, however, we will write an applet that simulates the Font/DA Mover by hard-coding a fixed set of fonts and/or desk accessories.

  1. Write an applet that partially simulates the Font/DA Mover. As a minimum requirement, the applet should have two scrollable lists and two pushbuttons ("Copy" and "Remove").
  2. Define two arrays of fonts, the initial font lists displayed in each scrollable list.
  3. Although the above screen shots don't show it, the scrollable lists should allow multiple selections.
  4. The scrollable lists should ignore ActionEvents, that is, double-clicking a font name should not perform any special action. Instead, treat a double click the same as a single click.
  5. Pressing the "Copy" button should copy the selected items from one list to the other. Note: Only one list may have selected items at a time!
  6. The label of the "Copy" button should dynamically reflect the direction of the copy operation. (Compare the above screen shots, for example.)
  7. Pressing the "Remove" button should remove the selected items from the list.
  8. Extra Credit: Implement the radio buttons, that is, define another pair of arrays for desk accessories.