• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems changing a JFrame to an Applet

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:



 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
BWA HA HA HA HA HA HA! Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic