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.

Ah, you want the two applets to be able to communicate with each other. You can do it with JavaScript, there's a very nice tutorial here : http://docs.oracle.com/javase/tutorial/deployment/applet/iac.html

The basic idea is to use the parent page's JavaScript context to pass messages between the two applets, because the page can see both applets.

Hope this helps!

Hi,

I agree with Ewald, but if you search a simple solution (if there is no message to passe from the first applet to the second) you can make a simple redirection to the html page wich contains the second applet. In this solution, you will have two web pages, each page contains one applet. To realize the redirection, you can use :

getAppletContext().showDocument()

A simple example is given here :

Click Here

Good Luck

commented: Nice idea. +3

Ah, redirecting to a second page could also work, it's a good suggestion.