• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Closing an Applet

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I close an Applet using the "Exit" button, which as been evoked from another applet and placed in a frame/window? Code as follows to call the second applet from the first:
Frame externalFrame = new Frame("Tile Shuffle Game");
externalFrame.setVisible(true);
TileGameApplet tga = new TileGameApplet();
externalFrame.add(tga);
boolean well = false;
externalFrame.setResizable(well);
int width = 300;
int height = 300;
externalFrame.setSize(width, height);
Window win = new Window(externalFrame);
//try to add windows listener to close applet as follows
WindowCloser listener = new WindowCloser();
win.addWindowListener(listener);
//and the I am trying to use the following to close the second applet but without much success:
class WindowCloser extends WindowAdapter
{
public void windowClosing( WindowEvent event )
{
//finalize();
setVisible(false);
//removeNotify();
}
}
I know that it can be done using JavaScript but I want to avoid this if possible.
Thanks,
Jon
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic