Fill in the empty frame class that has been provided each


You will be completing the implementation of a program that displays ASCII art animations. You will begin with code that loads a movie data- le. Your job is to create the code that parses that data, stores it as a series of \frames" of a movie, and then displays that movie, frame by frame, as an animation.

Your program comes with a set of sample movie les; you can create your own as well. Each movie is stored as a text- le, with features as follows:

The rst line of the le consists of two integers; these give, in order, the width and height of a single frame of the movie. (Since the movie is made up of ASCII art, these measurements are character widths and line heights, respectively.)

The rest of the le consists of a sequence of ASCII art images, encoding an animation sequence. Each frame must have the height given at the start of le; if the height value is h, and there are F frames of the movie, then the overall le must have (Fh + 1) lines total, including the numbers at the top.

Each line of a frame does not need to be of the same width value given; speci cally, some lines may be shorter than that value (none will be longer). For instance, when a line in a frame is empty, it may consist only of a single space, or even just a line-break symbol; in general, we cannot assume that white-space to the right-hand side of a frame is actually lled.

To complete this assignment, you will do the following things (not necessarily in order):

1. Fill in the empty Frame class that has been provided. Each object of this type will store data consisting of a single frame from an input le. The particular data structures and methods you implement in this class is up to you.

2. Create a class that implements Movie, an interface that is provided to you. Your class will consist of a data-structure that can hold a collection of frame data objects. It will also have two methods that can return frames of the movie, one at a time, in either front-to-back or back-to-front order, allowing movies to be played forwards or backwards. In either direction, a movie must terminate and display a still image when it reaches either end of its sequence of images. That is, when it reaches the end of the movie, the last frame of the movie should be displayed as a xed image, and if we play it backward, it should end by displaying the rst frame of the movie as a xed image. You may wish to extend an existing Java data- structure class for this purpose (or you many not). However you do it, you must implement the interface given, without any changes to that interface.

3. Create a class that implements MovieLoader, an interface that is provided to you. Your class must contain two methods, at least: one that takes in a le containing ASCII animation data, as described above, and one that returns a \movie" object containing that data in a playable form. You may wish to extend an existing Java data-structure class for this purpose (or you may not). However you do it, you must implement the interface given, without any changes to that interface.

4. Modify the existing ASCIIMator class. At present, that class allows you to choose and open a text- le (once the le has been opened, it can be referenced using the global inFile variable). When various buttons are pressed, some partial functionality is available. Your modi cations will ensure:

Until a le is loaded, pressing any of the buttons at the bottom of the screen will do nothing. When we load a new le, the rst frame of that movie will be displayed. When we press the step-forward button, `>'', the movie will advance by a single frame; similarly the step-back button, `<'', will rewind by one frame. The two play buttons, `>>'' and `<<'', will cause the movie to play in animated fashion, forward or backward, respectively.

Any playing of the movie, either automatically or manually frame-by-frame, will display a xed image (either the last or rst frame) whenever the movie reaches one end.

When displaying frames of a movie, each frame will have a border along each side, consisting of `|'' characters, as seen in the image at the start of this document.

Pressing the `X'' button will stop movie play, freezing the display in place until some other button is pressed.

Making these changes will involve, at the very least, modifying the existing actionPerformed() method. You may make other changes to the class, as needed.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Fill in the empty frame class that has been provided each
Reference No:- TGS0924837

Now Priced at $30 (50% Discount)

Recommended (95%)

Rated (4.7/5)