The following code attempts to draw a black rectangle from (10, 20) to (50, 40) with a

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 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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: