/***** Code de MesExemples.com *******/ import java.applet.Applet; import java.applet.AppletContext; import java.net.MalformedURLException; import java.net.URL; public class applet extends Applet { public void start() { URL codeBase = getCodeBase(); AppletContext context = getAppletContext(); try{ URL url = new URL(codeBase + "applet.html"); context.showDocument(url); }catch(MalformedURLException ex){ System.out.println (ex) ; } } } Code HTML d'exécution de l'applet <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//FR"> <html> <head> </head> <body bgcolor="000000"> <center> <applet code = "applet.class" width = "500" height = "300" > </applet> </center> </body> </html> |
Cet article Java-Applet: Charger un document HTML dans une applet est apparu en premier sur .