Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

How to get put a JPanel into a webpage

 
Andrew Cho
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
 
Paul Clapham
Sheriff
Posts: 21133
32
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?
 
john price
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
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
 
    Bookmark Topic Watch Topic
  • New Topic