-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathFrameFromApplet.java
More file actions
executable file
·46 lines (41 loc) · 965 Bytes
/
FrameFromApplet.java
File metadata and controls
executable file
·46 lines (41 loc) · 965 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
38
39
40
41
42
43
44
45
46
// <applet
// code = "FrameFromApplet.class"
// width = "420"
// height = "69"
// alt = "Applet Here"
// name = "FrameFromApplet"
// align = "center"
// >
// </applet>
import java.applet.Applet;
import java.awt.*;
class MyFrame extends Frame {
MyFrame(String title) {
// super(title); // Only needed if want to set properties like this (title in this case)
setTitle(title);
// Label l = new Label("Frame");
// l.setAlignment(Label.CENTER);
// add(l);
// setVisible(true); // NOT NEEDED
}
public void paint(Graphics g) {
g.drawString("Frame", 69, 69);
}
}
public class FrameFromApplet extends Applet{
Frame f;
public void init() {
f = new MyFrame("FrameFromApplet.java");
f.setSize(420, 420);
// f.setVisible(true); // NOT NEEDED
}
public void start() {
f.setVisible(true);
}
public void stop() {
f.setVisible(false);
}
public void paint(Graphics g) {
g.drawString("from Applet", 9, 20);
}
}