LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Java Applet (https://www.linuxquestions.org/questions/programming-9/java-applet-294947/)

ekl_n 02-25-2005 08:02 PM

Java Applet
 
I'm a beginner in Java programing.

I would like to know how the close the applet with the "Exit" button I have created to allow the user to close the applet without need to click onto the 'X' at the window top right hand-side button.

i use this code "System.exit(0);" to close the program but it seem don't work and a list on error display in the Dos by the Java compiler. :confused: I don't understand why my can't workout because when i have referred to many Java reference book & most of the book use "System.exit(0);" to close the applet. :study:

Pls advice :) .. 10q

aaa 02-26-2005 10:53 AM

System.exit is not allowed in applets for security reasons. See this:
http://java.ittoolbox.com/documents/document.asp?i=2568

snutz411 02-26-2005 11:48 AM

if your applet is on a JFrame, have the action listener for the button do something like

Code:

yourframe.dispose();
i'm efficient with java, but i haven't coded any applets, so if i'm wrong, my bad.


All times are GMT -5. The time now is 01:37 AM.