The following program draws squares recursively. Fill in the missing code.

```
import javax.swing.*;
import java.awt.*;

public class Test extends JApplet {
public Test() {
add(new SquarePanel());
}

static class SquarePanel extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);

int width = (int)(Math.min(getWidth(), getHeight()) * 0.4);
int centerx = getWidth() / 2;
int centery = getHeight() / 2;

displaySquares(g, width, centerx, centery);
}

private static void displaySquares(Graphics g, int width,
int centerx, int centery) {
if (width >= 20) {
g.drawRect(centerx - width, centery - width, 2* width, 2 * width);
displaySquares(_________, width - 20, centerx, centery);
}
}
}
}
```
a. getGraphics()
b. newGraphics()
c. null
d. g


d. g

Computer Science & Information Technology

You might also like to view...

Links from one page on a wiki to another page on the same wiki are known as

a. internal links. b. wiki links. c. external links. d. page links.

Computer Science & Information Technology

A client is concerned about a hacker compromising a network in order to gain access to confidential research data. Which of the following could be implemented to redirect any attackers on the network?

A. DMZ B. Content Filter C. Botnet D. Honeypot

Computer Science & Information Technology

What purpose does excluding pages from a menu serve?

What will be an ideal response?

Computer Science & Information Technology

What kernel mode component on Windows 10, insulates the kernel and device drivers from the complexities of the hardware?

A. Device Drivers B. Executive C. Hardware abstraction layer D. Application

Computer Science & Information Technology