• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closing window from an applet JButton

 
Jeen joy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have written a code in JApplet which opens a new window and i want to close the window on click of JButton. What could be solution?
I have implemented like this, which works for one time. Then program hangs.
on click of close button this function is called
void closeApplet()
{
try
{
URL fileURL = null;
fileURL = new URL(getCodeBase(), "/FinacleCRM/marketing/html/CloseTemplateWindow.html");
AppletContext browser = getAppletContext();
browser.showDocument(fileURL);
}
catch (Exception me)
{
}
}
////////CloseTemplateWindow.html/////////
<HTML>
<HEAD>
<SCRIPT>
top.window.close();
</SCRIPT>
</HEAD>
<BODY >
</BODY>
</HTML>
HELP me please, urgent it is
Thanks in advance
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeen
In the html file where you have this applet write a javascript method to close the window and call that method from the applet using netscape.javascript package that is part of Liveconnect functionality from Netscape. Look for JSObject (or netscape.javascript package) example on google to see how to use it...
Regards
Maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic