Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how do i call an applet from an applet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic