Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help me debug this Java program please! Below is main which does not need debugging Below that is the file that needs debugging. /* *

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

Students also viewed these Databases questions