• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bounce Two Images/create a graph app  RSS feed

Mickey Park
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do a school project that requires
me to bounce two images.
Write an applet to �bounce� two images around (the choice of images is up to you). The images should begin moving in some direction, and when they reach the edge of the applet, they should change direction. For example, if an image was moving �up
and to the right� and it hit the right edge, it should then move �up and to the left Allow the user to adjust the movement speed of the images separately, while theprogram is executing.
Note: you should use an instance of your callBackThread in this problem.

3. Create a graphing application that reads as many numbers as the user wishes and then displays the numbers in either bar-graph or line-graph form. The highest number should be placed on the upper end of the v-axis of the graph. Allow the user
to switch between line or bar graph. Make use of JFC; for example, consider placing the bar graph, line graph, and data on separate tabs. Include any additional functionality you think would be useful.

I am lost.. I have been trying to hammer out this one to do the image but it only has one image, and
i need two.
import java.awt.*;
class MyImage extends Frame{
static int xPixel = 20;
static int yPixel = 20;
Image myImage;
public MyImage(){
myImage = Toolkit.getDefaultToolkit().getImage("heart_cake.gif");
catch(Exception e){}
public void paint(Graphics g){
boolean b = g.drawImage(myImage, xPixel, yPixel, this);
void moveImage(){
for ( int i=0 ; i< 500 ; i++ ){
System.out.println("next set of Pixels " + xPixel);
for ( int j=1 ; j<5000000 ; j++)
{} //this just shows you one method
xPixel +=1;
yPixel +=1;
public static void main(String args[]){
MyImage me = new MyImage();
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!