Question: This is a java code that I need help completing! YOU CAN EARN 5 EXTRA CREDIT POINTS FOR FIXING THE GLITCH. What is the glitch?

This is a java code that I need help completing!

YOU CAN EARN 5 EXTRA CREDIT POINTS FOR FIXING THE GLITCH.

What is the glitch? Note that if you let off the mouse after dragging a line segment, then come back and drag another segment, it joins the new segment to where the previous segment left off. If you can fix this so that all the line segments you draw do not have to be contiguous, but be separated and independent, you get +5%.

You must hand in your modification of Etch_A_Sketch.java for your lab-11 submission. It will not (cannot) be script graded. It will be checked for compilation success at handin time.

You are to enhance the Etch_A_Sketch.java program as follows:

- Get rid of the x,y coordinate reporting.

- Add a JButton the user can click to change the drawing color.

- a simple JButton that when clicked, toggles between 4 colors is sufficient

Be sure you understand the difference between changing the color of a button's background vs. changing the current drawing color of the Graphics object.This is a java code that I need help completing! YOU CAN

89 90 91 92 |' 93 94 95 96 // draw dot (actually small line segment) between old (x, y) and current (x, y) Graphics gcontentPane.getGraphics ); 1/ use g to draw onto the pane 5-setColor ( currDrawingColor g.drawLine( oldx,oldY, mouseX, mouseY oldX mouseX; oldY = mouseY; reportEventCoords ("Mouse Dragged at: " + mouseX + "," + mouseY );

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!