forked from ChrisMayfield/ThinkJavaCode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoire.java
More file actions
27 lines (23 loc) · 666 Bytes
/
Moire.java
File metadata and controls
27 lines (23 loc) · 666 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
27
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");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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;
}
}
}