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
You might also like to view...
If a whine is from a CD or DVD drive, it will stop when the drive is not in use
Indicate whether the statement is true or false
When using the ____________________ tool, you can change the shield color and opacity of the area outside the crop using the Color and Opacity settings on the Options bar.
Fill in the blank(s) with the appropriate word(s).