-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExperimentalApplet.java
More file actions
37 lines (31 loc) · 980 Bytes
/
ExperimentalApplet.java
File metadata and controls
37 lines (31 loc) · 980 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
28
29
30
31
32
33
34
35
36
37
//******************************************************************************
// Filename: ExperimentalApplet.java
//
// Author: David C. Drake (https://davidcdrake.com)
//
// Description: ExperimentalApplet class. For science.
//******************************************************************************
import java.awt.*;
import java.applet.Applet;
public class ExperimentalApplet extends java.applet.Applet {
int[] x = new int[3], y = new int[3];
int centerX, centerY, height;
public void init() {
centerX = 250;
centerY = 250;
height = 300;
x[0] = centerX - (2 * height / 3);
y[0] = centerY + (height / 3);
x[1] = centerX;
y[1] = centerY - (2 * height / 3);
x[2] = centerX + (2 * height / 3);
y[2] = centerY + (height / 3);
resize(500, 500);
}
public void paint(Graphics g) {
g.setColor(Color.blue);
g.fillPolygon(x, y, 3);
g.setColor(Color.red);
g.drawRect(centerX, centerY, 1, 1);
}
}