• 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

convert application to applet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
mpa
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob, My source code is about 150 lines long for the Main.java 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?
thanks-
Mike
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic