This site requires JavaScript, please enable it in your browser!
Greenfoot back
rrose5
rrose5 wrote ...

2015/11/24

Java Applet Help

rrose5 rrose5

2015/11/24

#
I am creating an applet for my java class and I have gotten it to run but when I changed the main method to init and added a stop method the applet shows up blank . Java Code: http://pastebin.com/fPnjxk90 HTML code: http://pastebin.com/jZNHzDkC Thanks in advance guys!
danpost danpost

2015/11/24

#
A program must have a 'main' method to run. (do not worry, greenfoot users, greenfoot supplies one to a program when creating an applet or stand-alone)
rrose5 rrose5

2015/11/24

#
I thought applets needed to have and init method instead of a main method, I'm not using green foot for this project as it is an applet imbedded in an html page.
metland metland

2015/11/24

#
the init method is for setting things up, but the browser calls the 'start' method when it wants to run your applet. https://docs.oracle.com/javase/tutorial/deployment/applet/lifeCycle.html
danpost danpost

2015/11/24

#
rrose5 wrote...
I thought applets needed to have and init method instead of a main method, I'm not using green foot for this project as it is an applet imbedded in an html page.
Yes -- applets use 'init' methods that are called when the html page loads the applet. I should have checked the java tutorials before saying that they require a 'main' method to run.
rrose5 rrose5

2015/12/1

#
I found. Out the issue, there was an issue with the line with the window closing method, I just deleted that and it works perfectly. The problem was with security.
You need to login to post a reply.