Re: To open a browser window from a AWT frame.
Posted By:
vishwanath_dharanipragada
Posted On:
Friday, April 6, 2001 03:03 AM
I have found out the answer for myself. It goes like this:
In the applet create an instance of the frame like this:
Frame myframe;
myframe = (Frame) Class.forName("frameclassname").newInstance();
myframe.postEvent(new Event(myframe,-1,this);
.....
and in the frame's handleEvent method
we have
if(e.id==-1 && e.target==this)
init((applet)e.arg);
where
init(applet xx)
{
this.xx = xx;
}
now in the actionPerformed method of frame
we say:
if(....)
{
xx.getAppletContext().showDocument(url,"_blank");
thats it!
It works just magic!!!
Vishwanath
Re: To open a browser window from a AWT frame.
Posted By:
Guruprasad_LR
Posted On:
Friday, March 30, 2001 01:29 AM
Inside the actionPerformed() method Use Runtime and Process classes to achieve the desired result.
public void actionPerformed(ActionEvent ae)
{
Runtime rt=Runtime.getRuntime();
Process pr=rt.exec("iexplore.exe www.jguru.com");
pr.waitFor();
}
That should do it or you could also use JNI to communicate with the native code.