-
Notifications
You must be signed in to change notification settings - Fork 0
/
FleasFrame.java
92 lines (81 loc) · 2.64 KB
/
FleasFrame.java
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import java.awt.Event;
import java.awt.Frame;
import java.awt.Graphics;
// $FF: renamed from: b
public class FleasFrame extends Frame {
// $FF: renamed from: a int
int frameWidth;
// $FF: renamed from: b int
int frameHeight;
// $FF: renamed from: c int
int alwaysZero = 0;
// $FF: renamed from: d int
int heightAdjustment = 28;
// $FF: renamed from: e a
FleasApplet fleasApplet;
// $FF: renamed from: f java.awt.Graphics
Graphics fleasGraphics;
public FleasFrame(FleasApplet fleasApplet, int width, int height, String windowTitle, boolean resizable, boolean changeHeight) {
this.frameWidth = width;
this.frameHeight = height;
this.fleasApplet = fleasApplet;
if (changeHeight) {
this.heightAdjustment = 48;
} else {
this.heightAdjustment = 28;
}
this.setTitle(windowTitle);
this.setResizable(resizable);
this.show();
this.toFront();
this.resize(this.frameWidth, this.frameHeight);
this.fleasGraphics = this.getGraphics();
}
public final void paint(Graphics g) {
this.fleasApplet.paint(g);
}
// $FF: renamed from: a () int
public int getWidth_() {
return this.size().width;
}
public void resize(int width, int height) {
super.resize(width, height + this.heightAdjustment);
}
// $FF: renamed from: b () int
public int decrementHeight() {
return this.size().height - this.heightAdjustment;
}
public Graphics getGraphics() {
Graphics g = super.getGraphics();
if (this.alwaysZero == 0) {
g.translate(0, 24);
} else {
g.translate(-5, 0);
}
return g;
}
public boolean handleEvent(Event e) {
if (e.id == 401) {
this.fleasApplet.keyDown(e, e.key);
} else if (e.id == 402) {
this.fleasApplet.keyUp(e, e.key);
} else if (e.id == 501) {
this.fleasApplet.mouseDown(e, e.x, e.y - 24);
} else if (e.id == 506) {
this.fleasApplet.mouseDrag(e, e.x, e.y - 24);
} else if (e.id == 502) {
this.fleasApplet.mouseUp(e, e.x, e.y - 24);
} else if (e.id == 503) {
this.fleasApplet.mouseMove(e, e.x, e.y - 24);
} else if (e.id == 201) {
this.fleasApplet.destroy();
} else if (e.id == 1001) {
this.fleasApplet.action(e, e.target);
} else if (e.id == 403) {
this.fleasApplet.keyDown(e, e.key);
} else if (e.id == 404) {
this.fleasApplet.keyUp(e, e.key);
}
return true;
}
}