| |||||
| Dernière réponse | |
|---|---|
| Sujet : [Java] Images et IE | |
| rufo | Bon voilà, c'est mon code simplifié...
public class monapplet extends Applet implements runnable { private Graphics gBuffer; private Image background[]; private Image course; // Init public void init() { //Création d'une image de la taille de l'applet imb= createImage(640,480); gBuffer=imb.getGraphics(); for (i=0;i<4;i++) { background[i]=getImage(getCodeBase(),"images/Me nu/choix"+i+".jpg" ); } } public void run() { while(ma_condition !=0) { repaint(); gBuffer.drawImage(background[0],0,0,this); traitement(); // clic à un endroit ma_condition=0; } ma_condition=1; while(ma_condition !=0) { repaint(); gBuffer.drawImage(background[1],0,0,this); traitement(); // clic à un endroit ma_condition=0; } ma_condition=1; etc.... // quand c'est la fin, on clic qq part et on lance nettoyer(). // après, on redirige le navigateur vers une nouvelle page internet. AppletContext jeu2 = getAppletContext(); while (ma_condition!=0) { try { url_suivante = new URL("file:c:/toto/tata.html); jeu2.showDocument(url_suivante); } catch (java.net.MalformedURLException u) { System.out.println("URL mal formée !" ); } } } // gestion du double buffering public void update(Graphics g) { paint(g); } public void paint(Graphics g) { g.drawImage (imb,0,0, this); } public void nettoyer() { System.out.println("On nettoie" ); background[0]=null; background[1]=null; background[2]=null; background[3]=null; background[4]=null; course=null; System.gc(); System.runFinalization(); gBuffer.dispose(); //g.finalize(); System.gc(); System.runFinalization(); } } |
| Vue Rapide de la discussion |
|---|