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
You might also like to view...
Navigation forms can only be created if you have other forms and reports in your database
Indicate whether the statement is true or false
The data stored in an object are commonly called fields, or ____________.
a. attributes b. characteristics c. properties d. values