• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do i call an applet from an applet

 
subhadeep roy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
i am trying to write an application which requires me to call an applet from another applet. the calling applet has a button, pressing which calls the called applet . the "actionPerformed(ActionEvent e)" method of the calling applet has the following code:

public void actionPerformed(ActionEvent e)
{
String buttonpressed = e.getActionCommand();
if(buttonpressed == "Statistics")
{
mystat.init();
mystat.setVisible(true);
}
}
mystat is the instance of the called applet class.
Essentially I want a new window to appear, which starts the calling applet, when I press the button on the calling applet.
any help is greatly appreciated.
roy
 
Pradeepta Bhattacharya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Using AppletContext to get an instance of the other applet
[This message has been edited by Pradeepta Bhattacharya (edited September 09, 2001).]
 
Geoffrey Falk
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just posted a similar reply in the general Beginner area.
Basically, you should create a new class which extends Frame and then adds an instance of the applet (which is easy because Applet extends Panel).
Regards
Geoffrey, Canada
------------------
Sun Certified Programmer for the Java 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic