aspose file tools*
The moose likes Applets and the fly likes Problems changing a JFrame to an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Problems changing a JFrame to an Applet" Watch "Problems changing a JFrame to an Applet" New topic
Author

Problems changing a JFrame to an Applet

John Bose
Greenhorn

Joined: Jan 25, 2012
Posts: 5
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
Marshal

Joined: Mar 22, 2005
Posts: 41524
    
  53
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.


Ping & DNS - my free Android networking tools app
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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

Joined: May 09, 2002
Posts: 435
Yes, he did not put anything into the Applet. What will it display?


Maki Jav


Help gets you when you need it!
John Bose
Greenhorn

Joined: Jan 25, 2012
Posts: 5
Something came up and I won't be able to work on it for a few days. I'll let people know what happens.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems changing a JFrame to an Applet