Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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 know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic