Home Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Frequently Asked Questions Search

HardwareDude.com Forum Index -> 3rd Party Software Disucssion

How can I load a particular HTML page from within an applet?


Post new topic   Reply to topic

  Author    Thread
sri
Moderator
Moderator


Joined: 28 Jan 2006
Posts: 379
Location: Hyderabad , India


 Reply with quote  
How can I load a particular HTML page from within an applet?

How can I load a particular HTML page from within an applet?
Applets are executed within a web browser, and there's an easy way to load show a specific URL.
1 Obtain a reference to the applet context
2 Call the showDocument method, which takes as a parameter a URL object.The following code snippet shows you how this can be done.import java.net.*;
import java.awt.*;
import java.applet.*;
public class MyApplet extends Applet
{
// Your applet code goes here
// Show me a page
public void showPage ( String mypage )
{
URL myurl = null;
// Create a URL object
try
{
myurl = new URL ( mypage );
}
catch (MalformedURLException e)
{
// Invalid URL
}
// Show URL
if (myurl != null)
{
getAppletContext().showDocument (myurl);
}
}
}

- srikanth dhanwada

Post Wed Feb 08, 2006 9:31 pm 
 
  Display posts from previous:      



Post new topic   Reply to topic
Page 1 of 1



Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 



-Your Link Here-
Networking hardware and software solutions | web hosting directory
Powered by phpBB: © 2008 HardwareDude.com |Privacy | Terms of Service