Question: The following code attempts to draw a black rectangle from (10, 20) to (50, 40) with a line across its diagonal: DrawingPanel panel = new
The following code attempts to draw a black rectangle from (10, 20) to (50, 40) with a line across its diagonal:
DrawingPanel panel = new DrawingPanel(200, 100);
Graphics g = panel.getGraphics();
g.drawRect(10, 20, 50, 40);
g.drawLine(10, 20, 50, 40);
However, the graphical output looks like Figure 3G.20 instead. What must be changed for it to look as intended?

Drawing Panel
Step by Step Solution
3.45 Rating (164 Votes )
There are 3 Steps involved in it
The problem is that the parameters for the drawRect and drawLine methods have different meanings ... View full answer
Get step-by-step solutions from verified subject matter experts
