Skip to content

Commit 8ed04c5

Browse files
authored
Create appletComs.java
1 parent e918b31 commit 8ed04c5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

appletComs.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.applet.*;
2+
import java.awt.*;
3+
import java.awt.event.*;
4+
public class ContextApplet extends Applet implements ActionListener{
5+
Button b;
6+
7+
public void init(){
8+
b=new Button("Click");
9+
b.setBounds(50,50,60,50);
10+
11+
add(b);
12+
b.addActionListener(this);
13+
}
14+
15+
public void actionPerformed(ActionEvent e){
16+
17+
AppletContext ctx=getAppletContext();
18+
Applet a=ctx.getApplet("app2");
19+
a.setBackground(Color.yellow);
20+
}
21+
}

0 commit comments

Comments
 (0)