Question: easy Please help me debug this Java program package degugmetwo; import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; /* * THIS FILE REQUIRES DEBUGGING. * * HINT:

easy Please help me debug this Java program

package degugmetwo;

import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; /* * THIS FILE REQUIRES DEBUGGING. * * HINT: Read the Java API's for the paintComponent() method. * What method needs to be called from JPanel in order to paint to the * panel? Just because a program does NOT have any syntax error and it * compiles does not mean that it functions correctly!! These are some of * hardest things to debug. Remember, just becuase you have code that * contains NO syntax errors does not mean it will work properly!! * You may also want to review the Java API for help: * https://docs.oracle.com/javase/8/docs/api/javax/swing/JPanel.html */ public class CircleRamaPanel extends JPanel { // This method "should" draw a RED circle in the center of the panel. The error/debugging // is required in this method. Look at it carefully! @Override public void paintComponents(Graphics g){ super.paintComponent(g); g.setColor(Color.RED); g.fillOval(90, 85, 100, 100); } }

Below are other classes in the same package that do not require debugging if you need to see them /////////////////////////

public class CircleRamaTest { public static void main(String[] args) { // Create the frame CircleRamaFrame cr = new CircleRamaFrame(); } }

////////////////////////////

import javax.swing.JFrame; import javax.swing.JPanel; /* * THIS FILE REQUIRES NO DEBUGGING! */ public class CircleRamaFrame extends JFrame { public CircleRamaFrame(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setSize(300, 300); setLocationRelativeTo(null); // This centers the JFrame in the screen. setTitle("Circle Rama"); JPanel jp = new CircleRamaPanel(); add(jp); setVisible(true); } }

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!