This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi all. I have written a graphics Swing program where after pressing a start button, a game begins where you are given molecules and quizzed about them. As a JFrame, the program works fine. Here the abridged working code:
Now I am trying to put the program on the web and make an applet. As of now, I have written the following code and up loaded the program on my website. However, when I go to the site, the program does not show up. I get a white screen, even when I set the background to black. I know the problem is not the html code, because I got another simpler program to work as an applet, but for some reason this is not working. I do get the "Java" into before it goes blank, and I do not get an error message on the page when an applet normally does not work. I have the feeling I'm close, but what is wrong? Thank you for any help you can give. Here is the non-working applet:
a JFrame is a container to display your program as a stand-alone app.
an applet is a container to display your program in a browser ('extends Applet' is the container)
so, basically, you've added nothing to the applet container
read all the posts on this forums first page, you should find plenty of sample code to study
as most of your components are Swing, extend JApplet do not use invokeAndWait()
never use mouseClicked() - pressed or released are much better