Fermer page html a partir d'une applet

Fermé
darkgenesis - 26 févr. 2008 à 18:26
 Utilisateur anonyme - 3 mars 2008 à 17:50
Bonjour,

je pense que tout est dans le titre,

j'ai une applet java qui s'ouvre à partir d'une page html, et j'aimerai que quand j'appuie

sur un bouton, la page qui contient l'applet se ferme, le probleme c'est que je ne trouve pas

de méthode pour, j'ai bien la façon d'ouvrir la page html , mais pas pour la fermer.

merci beaucoup
A voir également:

3 réponses

Utilisateur anonyme
27 févr. 2008 à 15:30
Tu as essayer d'utiliser la méthode dispose() ?
0
merci pour ta réponse, mais c'est une applet,pas une JFrame, donc la méthode dispose() ne fonctionne pas, tout comme la méthode close().
0
Utilisateur anonyme
3 mars 2008 à 17:50
J'ai trouvé ce commentaire sur le net :

Why do you want to "exit" the applet? To make the form disappear after data entry?

The JVM that the browser uses will prevent an untrusted applet from accessing the local file system or executing anything on the local system. That was one of the reasons for applets' popularity - they can't trash a local system accidentally or otherwise. The destroy() method is called by the browser only when the page closes. Calling it yourself from within the applet will execute any code that it contains but still will not "exit" the applet.

Try using:
setVisible(false) on the main container object or setPreferredSize(0,0)...

Apparement tu ne peux pas fermer l'applet sur le clic d'un bouton par contre tu peux la rendre non visible.
0