This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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?
I'll give you a hint : Extend JApplet, not JPanel...This is the easiest solution...
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Joined: Jun 29, 2011
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)