Question: Using the code provided, (Java) import java.awt.*; import javax.swing.*; public class ball144 extends JFrame implements Runnable /* since extends JFrame, must implements Runnable since can

Using the code provided, (Java)

import java.awt.*;

import javax.swing.*;

public class ball144 extends JFrame implements Runnable

/* since extends JFrame, must implements Runnable

since can only extends one class */

{

boolean stopflag;

int x, y;

Container c;

public ball144()

{

c = getContentPane();

c.setBackground(Color.cyan);

stopflag = false;

x = 0;

y = 50;

setTitle("Ball");

setForeground(Color.blue);

}

public void end()

{

// TODO Auto-generated method stub

}

@Override

public void run()

{

}

}

/* write run() method that will switch stopflag and loop and keep calling repaint() while the ball is not stopped and the ball is on the frame (the ball width less than the right side). When done, end the ball thread. */

// write update method to not clear frame and call paint()

/* write paint() method to cover old ball, move x across the screen and draw new ball */

/* write end() method that will switch stopflag and draw final ball */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!