• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to go to an HTML page from applet?

 
Mike London
Ranch Hand
Posts: 1216
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you transfer to HTML page from an Applet?
In other words, if the user clicks a button, I'd like to transfer control of the applet to an HTML page (that is, show the HTML page). This would be a "file preview" page.

Can this be done easily?
Thanks in advance.
-- Mike
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,
I may be misinterpreting your question, but do you not know about the "showDocument()" method in "java.applet.AppletContext"?
http://java.sun.com/j2se/1.4.1/docs/api/java/applet/AppletContext.html
To get a reference to "AppletContext", use the "getAppletContext()" method in "java.applet.Applet"
Hope this helps.
Good Luck,
Avi.
 
Mike London
Ranch Hand
Posts: 1216
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow,
This was EXACTLY what I needed. It's always a bit of a pain to implement an interface and override all the methods (when you only want one, that is).
The key code I added in the actual method you told me about is below.
public void showDocument (URL url,
String target)
{
getAppletContext().showDocument(url, "_blank");
}
Thank you very much!!!
-- Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic