Skip to content

Commit b5941da

Browse files
authored
Create AppletCom.java
1 parent a6dc605 commit b5941da

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

AppletCom.java

Lines changed: 21 additions & 0 deletions
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)