Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

convert application to applet

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very new to java and am having trouble getting an application which I am trying to convert into an applet to run in a web page. I have replaced the constructor in Main() with the Init() method and included all of Main()'s code within Init(){..}. I have it so that the webpage says "Applet Main Started", however nothing shows up but the grey applet box. One issue that could be causing a problem is that in order to get this far, I had to change this line of code- Container content = getContentPane();- to- JPanel content = new JPanel();- in order to get the application to compile and produce the .class files. Any help or direction would be appreciated.
Thnks from a Java newbie
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How big is your source file? If it's not too large you could post it here. It's a lot easier to help you if we have access to the source code!
When you post your source code, please use the CODE tags to format it. The easiest way is to use the "CODE" button that is located below the message box, under "Instant UBB Code".
Mike Adamchuk
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob, My source code is about 150 lines long for the file so I will provide the important parts here (very beginning and very end). Also, I changed the code so Main extends JApplet so that it is Swing compliant and I can use the "Container content = getContentPane();" code at the end of the page, instead of having to change it to "JPanel content = new JPanel();".
-----------------START OF CODE-------------------

-------------------END OF CODE-------------------------------
Is this enough of the code for you and do you need to know anything else about how the program is set up?
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic