forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoire.java
More file actions
26 lines (22 loc) · 604 Bytes
/
Moire.java
File metadata and controls
26 lines (22 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
public class Moire extends Canvas {
public static void main(String[] args) {
JFrame frame = new JFrame("Moire Pattern");
Canvas canvas = new Moire();
canvas.setSize(400, 400);
canvas.setBackground(Color.white);
frame.add(canvas);
frame.pack();
frame.setVisible(true);
}
public void paint(Graphics g) {
int i = 90;
while (i < getWidth()) {
g.drawOval(0, 0, i, i);
i = i + 3;
}
}
}