Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 505781b

Browse files
committedSep 8, 2017
Chapter 09 codes updated.
1 parent d3e1ad2 commit 505781b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+432
-664
lines changed
 

‎09-Fractal-Drawing/02-Recursive-Circle-Drawing/src/AlgoFrame.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
import java.awt.Graphics2D;
2-
import java.awt.Graphics;
3-
import java.awt.Dimension;
4-
import java.awt.Color;
5-
import java.awt.RenderingHints;
6-
import java.util.ArrayList;
7-
import java.util.Map;
8-
import java.util.HashMap;
9-
1+
import java.awt.*;
102
import javax.swing.*;
113

124
public class AlgoFrame extends JFrame{
135

146
private int canvasWidth;
157
private int canvasHeight;
16-
private JPanel canvas;
178

189
public AlgoFrame(String title, int canvasWidth, int canvasHeight){
1910

@@ -41,8 +32,8 @@ public AlgoFrame(String title){
4132
public int getCanvasHeight(){return canvasHeight;}
4233

4334
// data
44-
CircleData data;
45-
public void setData(CircleData data){
35+
private CircleData data;
36+
public void render(CircleData data){
4637
this.data = data;
4738
repaint();
4839
}

‎09-Fractal-Drawing/02-Recursive-Circle-Drawing/src/AlgoVisHelper.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import javax.swing.*;
22
import java.awt.*;
33
import java.awt.geom.Ellipse2D;
4-
54
import java.awt.geom.Rectangle2D;
65
import java.lang.InterruptedException;
76

8-
97
public class AlgoVisHelper {
108

119
private AlgoVisHelper(){}
@@ -33,35 +31,35 @@ private AlgoVisHelper(){}
3331
public static final Color White = new Color(0xFFFFFF);
3432

3533

36-
static public void strokeCircle(Graphics2D g, int x, int y, int r){
34+
public static void strokeCircle(Graphics2D g, int x, int y, int r){
3735

3836
Ellipse2D circle = new Ellipse2D.Double(x-r, y-r, 2*r, 2*r);
3937
g.draw(circle);
4038
}
4139

42-
static public void fillCircle(Graphics2D g, int x, int y, int r){
40+
public static void fillCircle(Graphics2D g, int x, int y, int r){
4341

4442
Ellipse2D circle = new Ellipse2D.Double(x-r, y-r, 2*r, 2*r);
4543
g.fill(circle);
4644
}
4745

48-
static public void strokeRectangle(Graphics2D g, int x, int y, int w, int h){
46+
public static void strokeRectangle(Graphics2D g, int x, int y, int w, int h){
4947

5048
Rectangle2D rectangle = new Rectangle2D.Double(x, y, w, h);
5149
g.draw(rectangle);
5250
}
5351

54-
static public void fillRectangle(Graphics2D g, int x, int y, int w, int h){
52+
public static void fillRectangle(Graphics2D g, int x, int y, int w, int h){
5553

5654
Rectangle2D rectangle = new Rectangle2D.Double(x, y, w, h);
5755
g.fill(rectangle);
5856
}
5957

60-
static public void setColor(Graphics2D g, Color color){
58+
public static void setColor(Graphics2D g, Color color){
6159
g.setColor(color);
6260
}
6361

64-
static public void setStrokeWidth(Graphics2D g, int w){
62+
public static void setStrokeWidth(Graphics2D g, int w){
6563
int strokeWidth = w;
6664
g.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
6765
}

0 commit comments

Comments
 (0)
Please sign in to comment.