Hi to all,
I have following two Applets .
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class buttonDemo extends Applet implements ActionListener
{
String msg="";
Button one,two,three;
public void init()
{
one=new Button("One");
two=new Button("Two");
three=new Button("Three");
add(one);
add(two);
add(three);
one.addActionListener(this);
two.addActionListener(this);
three.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if(str.equals("One"))
{
msg="You pressed one";
}
else
if(str.equals("Two"))
{
msg="You pressed two";
}
else
{
msg="You pressed three";
}
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,10,20);
}
}
And
import java.awt.*;
import java.applet.*;
public class appletDemo extends Applet
{
String msg;
public void init()
{
appletDemo a= new appletDemo();
a.setSize(500,100);
setBackground(Color.pink);
msg="A simple applet";
}
public void paint(Graphics g)
{
g.drawString(msg,10,20);
}
}
I wand to call second Applet window from the "One" button in first Applet.
I don't have any idea about calling one Applet from another Applet' button.
Please give me hint about it.
Thanks.