Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
65 lines (47 loc) · 992 Bytes

File metadata and controls

executable file
·
65 lines (47 loc) · 992 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package inheritance;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.Random;
import goo.Goo;
public class ShapeApp extends Goo {
private Shape shape;
private Random random;
private boolean fill = true;
public ShapeApp(int w, int h, boolean tryFSE) {
super(w, h, tryFSE);
setRandom(new Random(2001));
}
public void init(int n) {
}
public void draw(Graphics g) {
if (!fill)
getShape().draw(g);
else
getShape().fill(g);
}
public void mouseClicked(MouseEvent e) {
init(shape.getNVertices());
repaint();
}
public void keyPressed(KeyEvent e) {
char key = e.getKeyChar();
if (key == 'f')
fill = true;
else if (key == 'd')
fill = false;
repaint();
}
public void setRandom(Random random) {
this.random = random;
}
public Random getRandom() {
return random;
}
public void setShape(Shape shape) {
this.shape = shape;
}
public Shape getShape() {
return shape;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.