Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi Everyone I need the answer for this question in the picture in Java as soon a

ID: 674668 • Letter: H

Question

Hi Everyone

I need the answer for this question in the picture in Java as soon as possible to be run in NetBeans

I need to be able to copy it

So, please do not put the answer as a picture

Wite an application class (CircleDrawApp) that extends from JFrame The class contains the following 1. an instance vaiable, diameter (type double 2 a JPanel reference variable (or reference to a subclass of JPanel) 3.a one agument constructr whee he argumentreceives avalue that species te diameter 3 a one argument constructor, where the argument receives a value that specifies the diameter to be used for drawing a circle (the diameter must be accessible via reference described in item 2 above) The constructor must also ad a JPanel instance to the JFrame top-level window 4. a mainmethod (ie, with signature public static void mainStringl args)) The application must draw a illed circle (any color at the location where the mouse is clickedn the JPanel instance that has been added to the center of the JFrame instance. Provide any aditional classes as required (e, these must be package level, in order to include in the same file

Explanation / Answer

import java.awt.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.event.*; import java.awt.geom.*; public class test extends JFrame implements ActionListener, MouseListener { Shape circle = new Ellipse2D.Float(10, 10, 10, 10); public test () { setSize(250,150); addMouseListener(this); } public static void main(String[] args) { //TODO code application logic here java.awt.EventQueue.invokeLater(new Runnable() { public void run() { test frame = new test(); frame.setVisible(true); } }); } public void actionPerformed(ActionEvent ae) { } public void drawCircle(int x, int y) { Graphics g = this.getGraphics(); g.drawOval(x, y, x, y); g.setColor(Color.BLACK); g.fillOval(x, y, 2, 2); } public void mouseClicked(MouseEvent e) { drawCircle(e.getX(), e.getY()); repaint(); } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } }