mravell
asked on
AppletContext sample
Anyone out there have an example of an applet which uses the AppletContext stuff to load a URL into a new browser window? I've been banging my head against this to no avail and would like to see some source from someone who has either done it or has one of those phone-book size Java manuals with a handy example to plagiarize.
100 points for a quick sample.
TIA
Marty
100 points for a quick sample.
TIA
Marty
ASKER
Hi Ravindra,
Can you post some actual applet code? I got this much from the Java Doc already.
Do I have to implement the AppletContext interface or something?
Some actual working source is what I'm really after. Please assume ignorance on my part!
Regards
M
Can you post some actual applet code? I got this much from the Java Doc already.
Do I have to implement the AppletContext interface or something?
Some actual working source is what I'm really after. Please assume ignorance on my part!
Regards
M
If your program is an applet, it already has a valid AppletContext and ravindra76's example is actually a piece of code.
Cheers,
Nik
Cheers,
Nik
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi mravell, Didn't you try the piece of code given by Ravindra?
Run this code as
Jump.html :-
Note: put this jump.html and Jump.class in ur webserver document root.
for me it is http://localhost/jump.html
<HTML><HEAD></HEAD><BODY>
<APPLET CODE="Jump.class"
HEIGHT=100
WIDTH=300>
</APPLET></BODY></HTML>
Jump.java
import java.awt.*;
import java.applet.*;
import java.net.*;
public class Jump extends Applet {
Button btnJump;
public void init() {
btnJump = new Button("JUMP To");
add(btnJump);
}
public boolean action(Event e,Object o) {
if ( e.target.equals(btnJump)) {
try {
getAppletContext().showDoc
}
catch ( Exception ee) {
System.out.println("Malfor
}
}
return false;
}
}
Here xxx is the target frame.
Since there is no frame at all, it will open a new window
url is the url U have to give in the format
http://yourserver:serverport/file