0

I have a final project for computer science due tommorow, this works as an application but won't display anything as an applet which is what we need it to be. (it was coded as an app then converted to an applet)

i dont undertsand how this whole posting code things works on this site so i put it on pastebin.com http://pastebin.com/kiFmzbfp

Is there in which I could run a jar using an applet?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

1

Is there in which I could run a jar using an applet?

Yes. Though it is not the best way to go about showing a GUI from an applet.

Add the Jar to both the compile-time & run-time class-path (int the archive attribute) of the applet. Within the applet init(), remove start(); and add the code within the current main(String[]). Vis.

UserInterface runner = new UserInterface();
runner.Interface();

MainCode run = new MainCode();
run.Change_InterFace();

Preferably that code should be called on the EDT (Event Dispatch Thread). See Concurrency in Swing for more details.

But the code will have problems as an applet, since it attempts to access resources by File rather than URL. This has been discussed in the last 24 hours.


Noting that is 443 lines of code dump at the paste bin,this is as far as I am prepared to investigate. You have ..around 17 hours left till the dead-line, so you'd better get cracking.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • And as an aside.. *"as an applet which is what we need it to be."* Given this is a school project suggests that was from the instructor. Please ask them from me, to kindly join us in the 3rd millennium & specify an app. launched using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info). JWS can launch frames and applets free floating, or in recent times, also embed applets in web pages. But there has to be a very good reason to cram a rich client (Swing) into a thin client (HTML). This is not one of them. If they actually stated ""must be available on the web"* do w. JWS. – Andrew Thompson Jan 14 '13 at 09:01