PDA

View Full Version : CARTOON STRIP...need help!!



sushi2hot4u
03-17-2008, 09:55 AM
Hi, i have imported necessary files to make a cartoon strip with 2 figures with simple animations but dont know what to do how where it says
// YOUR CODE HERE
Please suggest some codes , instructions are highlighted in BLUE...

thanks to all who read or post...

import java.util.*;
import comp100.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.io.*;

/** Program to create simple animated cartoon strips using the
* CartoonFigure class.
*/

public class CartoonStrip{

/** animate first creates a JFrame window and a DrawingCanvas.
* Then creates two cartoon figures and places them on the window.
* Then animates them according to a fixed script by calling a series
* of methods on the figures.
*/
public void animate(){
JFrame frame = new JFrame("Jim and Jan");
frame.setSize(600, 500);
DrawingCanvas canvas = new DrawingCanvas();
frame.getContentPane().add(canvas, BorderLayout.CENTER);
frame.setVisible(true);


// YOUR CODE HERE

// Delete the window
frame.dispose();
}

/** animateFromInput first creates a JFrame window and a DrawingCanvas
* Creates two cartoon figures and places them on the window.
* Then prompts for and reads instructions from System.in to control the
* two figures. Each instruction must start with the name of the character
* (Jim or Jan), followed by a command: left, right, move, smile,
* frown, talk, or exit
* If the command is move, it must be followed by a single integer
* (the distance to move).
* If the command is talk, it must be followed by some words to say.
* If the command is exit (or quit), then the method exits,
* for all the other commands, the command is applied to the
* specified cartoon figure.
*/
public void animateFromInput(){
JFrame frame = new JFrame("Extension: Jim and Jan");
frame.setSize(700, 400);
DrawingCanvas canvas = new DrawingCanvas();
frame.getContentPane().add(canvas, BorderLayout.CENTER);
frame.setVisible(true);

// YOUR CODE HERE

// Delete the window
frame.dispose();
}

public static void main(String[] arguments){
CartoonStrip cs = new CartoonStrip();
cs.animate();
}

}