Discuss the below:
Read and Understand Code
Q: What is the length of the line being drawn?
g.drawLine (50, 20, 50, 350);
What is the (x, y) coordinate of the lower-right corner of the rectangle being drawn?
g.drawRect (10, 20, 250, 350);
Fill in the code
This code sets the current color to red
// assume you have a Graphics object named g
// code goes here
This code draws the string "Fill in the Code" with the lower-left corner of the first character (the f) being coordinate (100, 250).
// assume you have a graphics object called g
// code goes here
Identifying Errors in Code
Where is the error in this code sequence?
// we are inside method paint
g.drawString ('find the bug', 100, 200);
Where is the error in this code sequence?
// we are inside method paint
g.setColor(green);