This topic contains a solution. Click here to go to the answer

Author Question: The following program draws squares recursively. Fill in the missing code.import ... (Read 50 times)

jrubin

  • Hero Member
  • *****
  • Posts: 552
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);
}
}
}
}

◦ newGraphics()
◦ g
◦ getGraphics()
◦ null


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by jrubin on May 6, 2020

SeanoH09

  • Sr. Member
  • ****
  • Posts: 323
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 29% of students answer this correctly




jrubin

  • Member
  • Posts: 552
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


strudel15

  • Member
  • Posts: 324
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

Limit intake of red meat and dairy products made with whole milk. Choose skim milk, low-fat or fat-free dairy products. Limit fried food. Use healthy oils when cooking.

Did you know?

In 2012, nearly 24 milliion Americans, aged 12 and older, had abused an illicit drug, according to the National Institute on Drug Abuse (NIDA).

Did you know?

The oldest recorded age was 122. Madame Jeanne Calment was born in France in 1875 and died in 1997. She was a vegetarian and loved olive oil, port wine, and chocolate.

Did you know?

More than 50% of American adults have oral herpes, which is commonly known as "cold sores" or "fever blisters." The herpes virus can be active on the skin surface without showing any signs or causing any symptoms.

Did you know?

Patients who have been on total parenteral nutrition for more than a few days may need to have foods gradually reintroduced to give the digestive tract time to start working again.

For a complete list of videos, visit our video library