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

How to get put a JPanel into a webpage

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Report post to moderator
hey all,

I have a java program that extends JPanel, and i've tried putting it into a JApplet and into HTML, an Applet into HTML, and a JApplet into HTML using frontpage and nothing seems to work. could anyone tell me how to or give me code for putting a JPanel into a webpage?

Thanks a bunch,
Andrew
 
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
To put Java code into a web page, you use an applet. In the 21st century a JApplet is the preferred method. (Not JNLP, so I will move the post to the forum about applets.) But I'm surprised you ask for code; obviously you have tried some things already. So the suggestion that you should throw all of those things away completely, disregarding all of the error messages you surely must have had, doesn't make much sense.

So let's start with what you have so far. Presumably you've already tracked down applet tutorials on the web and are working from them?
 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'll give you a hint : Extend JApplet, not JPanel...This is the easiest solution...

cc11rocks
 
Andrew Cho
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks guys,

I actually figured out that its not a problem with applets or panels. I have been doing that right the whole time. The problem is that in my program, i retrieve data from a SQL database. When I run the program just through a JFrame, it works fine, but when I try to run it through a JApplet, it doesn't work.

I tried tests as well, having basically the exact same code in a normal class file that uses main, and in a JApplet. In the non-applet program, getting data from the database works flawlessly, but in the applet, it cant get the connection.

Should I continue to ask for answers in this post, or should i start a new one? (I'm kind of new to the ranch)

thanks,
Andrew
 
Paul Clapham
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
 
I'm full of tinier men! And a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic