Skip to Content

Load New HTML File Using Applet Context Example

  • strict warning: Non-static method view::load() should not be called statically in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter_boolean_operator.inc on line 0.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_style_default.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.

  1. /*
  2.         Load New HTML File Using Applet Context Example
  3.         This java example shows how load a new file in a browser using
  4.         showDocument() method of AppletContext.
  5. */
  6.  
  7. import java.applet.Applet;
  8. import java.applet.AppletContext;
  9. import java.net.MalformedURLException;
  10. import java.net.URL;
  11.  
  12. /*
  13. <applet code="LoadNewHTMLFileExample" width=200 height=200>
  14. </applet>
  15. */
  16.  
  17.  
  18. public class LoadNewHTMLFileExample extends Applet{
  19.  
  20.         public void start(){
  21.                
  22.                 //get code base of an Applet using getCodeBase() method
  23.                 URL codeBase = getCodeBase();
  24.                
  25.                 //get AppletContext using getAppletContext() method
  26.                 AppletContext context = getAppletContext();
  27.                
  28.                 /*
  29.                  * To load a new HTML file in a browser use
  30.                  * void showDocument(URL url)
  31.                  * method of AppletContext class.
  32.                  *
  33.                  * PLEASE NOTE that the new HTML document must be in the
  34.                  * same directory.
  35.                  */
  36.                
  37.                 try{
  38.                        
  39.                         URL url = new URL(codeBase + "AppletContextExample.html");
  40.                         context.showDocument(url);
  41.                        
  42.                 }catch(MalformedURLException me){
  43.                         //do nothing
  44.                 }
  45.         }
  46. }