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 52 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
Wow, this really help


emsimon14

  • Member
  • Posts: 344
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Oxytocin is recommended only for pregnancies that have a medical reason for inducing labor (such as eclampsia) and is not recommended for elective procedures or for making the birthing process more convenient.

Did you know?

Nearly all drugs pass into human breast milk. How often a drug is taken influences the amount of drug that will pass into the milk. Medications taken 30 to 60 minutes before breastfeeding are likely to be at peak blood levels when the baby is nursing.

Did you know?

Only 12 hours after an egg cell is fertilized by a sperm cell, the egg cell starts to divide. As it continues to divide, it moves along the fallopian tube toward the uterus at about 1 inch per day.

Did you know?

Pope Sylvester II tried to introduce Arabic numbers into Europe between the years 999 and 1003, but their use did not catch on for a few more centuries, and Roman numerals continued to be the primary number system.

Did you know?

Disorders that may affect pharmacodynamics include genetic mutations, malnutrition, thyrotoxicosis, myasthenia gravis, Parkinson's disease, and certain forms of insulin-resistant diabetes mellitus.

For a complete list of videos, visit our video library