Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems changing a JFrame to an Applet

 
John Bose
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:



 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any messages in the Java Console? That's where errors would show up.

Post the applet tag, and also the structure of the files and directories in the file system.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, he did not put anything into the Applet. What will it display?


Maki Jav
 
John Bose
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something came up and I won't be able to work on it for a few days. I'll let people know what happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic