Question: Need help writing a Java code to display a graph of the quadratic equation. To make a JPanel of some reasonable size in a window
Need help writing a Java code to display a graph of the quadratic equation. To make a JPanel of some reasonable size in a window theb turn it into a GPanel, and put the calls into the paint method of the GPanel.
Hints: create a method in GPanel to set and remember the QuadObject object(with a name like setQO, perhaps). Save a copy of the (pointer to) the QuadObject the same way the sample GPanel saves the Graphics object g. Then you can graph x against quadObject.f(x).
Make you GPanel invisible when it is first created and added to the graphics environment. In the event handler for the DrawGraph button:
1. Figure out xmin..ymax by calculating them using Double.parseDouble from their appropriate text fields
2. Use a method in GPanel to pass in those four xmin..ymax values.
3. Create your QuadObject object by reading text fields for a, b, and c.
4. Pass in that QuadObject object to the GPanel.
5. Figure out how to tell the GPanel its width and height, or make it "read" its own height and width using getHeight() and getWidth() methods it inherits from JPanel
6. Make the GPanel visible by using the setVisible() method inherited from JPanel

Xmin -10.0 Xmax 10.0 Ymin 10.0 Ymax 10.0 A 2 B -14 C 24 Draw Graph
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
