Homework 4
Home Up

 

CS4984 HOMEWORK #4

DUE: April 19, 2001

 

 

Problem #1

The class "MediaItem" represents information from multimedia objects. The information it contains includes:

  • Unique ID: integer
  • Item name
  • URL
  • Type: There are four types, text, image, audio, and video. These types are specified with named constants TEXT, IMAGE, AUDIO, VIDEO with values 0, 1, 2, 3 respectively.

The code for this class is given (click here). Your task is to implement a class entitled "MediaList" that implements a dynamic aggregate of MediaItem objects using the Vector class, which is part of the Java programming language. Provide appropriate constructors and methods to add and delete a MediaItem object from the aggregation.

 


 

Problem #2

Implement a class called "MediaListManager" that provides a GUI interface that adds, deletes, and modifies items stored in a MediaList aggregate passed as an argument in its constructor. Use a JList Swing component to display the list of items contained in the MediaList aggregation. At the bottom of the display, implement three buttons (JButton): add, delete, and modify. The delete button shall delete the current item selected from the list (if any). Both the add and modify buttons shall cause a panel (JPanel) to pop up that allows updates to be entered. The pop-up panel should contain two text fields (JTextField) to allow the user to enter/modify the "name" and "URL" fields and one combo box (JComboBox) to allow the user to select one of the four media types. For the modify operation, the three components should display the content of the MediaItem object to be modified; for the add operations, the "name" and "URL" fields should be set to null initailly and the combo box should be set to "text" initially. In addition to the above three components, the pop-up panel should contain two buttons (JButton) "OK" and "Cancel". The add/modify operation is takan into effect only when the "OK" button is pressed. When the "Cancel" button is pressed, the pop-up panel disappears without any effect. The user is not allowed to view or modify the ID field. Any updates made must be reflected to both the MediaList aggregate and the display until exit.

A tester application "HwFourTest.java" is attached here to test your implemented classes in problems #1 and #2.


Copyright © 2000-2001 First Principles. All rights reserved.
For problems or questions regarding this web contact webmaster.
Last updated: 07 June 2001 23:06:27 -0400.