Question: Java Debugging Easy Help me debug this Java program please! Below is main which does not need debugging Below that is the file that needs
Java Debugging Easy
Help me debug this Java program please!
Below is main which does not need debugging
Below that is the file that needs debugging.
/* * NOTE: This file does not require debugging * */
package debugmeone;
import javax.swing.JFrame;
public class DrawMe extends JFrame { public static void main( String args[] ) { // create frame for CirclesJPanel JFrame frame = new JFrame( "Draw Me" ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
DrawMePanel circlesJPanel = new DrawMePanel(); frame.add( circlesJPanel ); // add circlesJPanel to frame frame.setSize( 200, 250 ); // set frame size frame.setVisible( true ); // display frame } // end main }
///////////////////Here is the code that needs debugging
/* * NOTE: This file requires debugging. In order for Java to draw on your * screen, it calls a very important method. You would seldom call this * method but Java will call it every time it needs to draw your graphics. * * This small program draws 8 circles on a JPanel each of larger size as * it loops. Add the method required to draw the circles on the JPanel. */ package debugmeone;
import java.awt.Graphics; import javax.swing.JPanel;
public class DrawMePanel extends JPanel { for ( int topLeft = 0; topLeft < 80; topLeft += 10 ) { int radius = 160 - ( topLeft * 2 ); g.drawArc( topLeft + 10, topLeft + 25, radius, radius, 0, 360 ); } // end for }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
