Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Embedding my game on website.  (Read 396 times)
0 Members and 1 Guest are viewing this topic.
Offline herah

Senior Newbie





« Posted 2013-02-20 00:48:43 »

Hey everyone, I am completely new to making java applets and just built my first game. It's an executable jar file and I'd like to link it here as well as add it to my own wordpress webpage. I don't understand what needs to be done to do this however. I have the plugin for wordpress and I guess I just dont understand what I need to put in.

<code>[applet code="your.applet.ClassName" file="http://domain.com/full/path/to/yourJar.jar"]</code><br />

I know the url to my file, but not what to put in for your.applet.ClassName.  I have been trying to just put in the name of the class with my main method in it but get an error.

Thank you, I realize this is a pretty dumb question but I dont get it.
Offline philfrei
« Reply #1 - Posted 2013-02-20 03:11:54 »

Neat! I didn't know WordPress had an Applet plugin! Where did you get it? I want to get a copy for my site.

It wouldn't be an invocation of the "main()" method, because that is for applications and not applets.

The name should be a JApplet or Applet object, and you should include the package structure as part of the url.


"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #2 - Posted 2013-02-20 03:35:24 »

@Philfrei, search in the plugin market for "Java Applet Embed" Smiley

Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline herah

Senior Newbie





« Reply #3 - Posted 2013-02-20 16:23:35 »

Ah I see, that makes sense now. I guess the problem is that I have never made an applet before and don't know how to go about changing my program into an applet. From the small amount of reading I did, it seemed that I needed an applet class, then have my game extend applet. I must be misunderstanding this because my classes already extend frame so i can't seem to also extend applet. I dont know if this makes any sense. As I said, I am brand spanking new to this. I'd be happy to send my file to someone if it would make more sense for help converting it.

Thanks for the replies.
Offline philfrei
« Reply #4 - Posted 2013-02-21 00:36:30 »

JFrame is a top-level container. So is JApplet. Everything has to be contained in either one or the other.

http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html

There is an article that shows how to make a next-to-top level container that can be dropped into either, so you don't have to do a lot of "duplicate" coding at the top. It's somewhere in the "deployment" section of the tutorials, but I have to run and can't track it down right now. Sorry.

 [EDIT: I'm back. I found this link http://docs.oracle.com/javase/tutorial/deployment/applet/developingApplet.html which makes a reference to making a top-level JPanel. This isn't the article I remember, but this is pretty much the idea, that either the JFrame or the JApplet can display the same JPanel.

By the way, a jar file can contain both a JFrame and a JApplet, but only one or the other gets invoked when you run the program. In other words, if you have a class with a main() in it, but you use the html to open the jar, you would address the JApplet (or subclass) not the class with the main().]

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (34 views)
2013-05-17 21:29:12

alaslipknot (42 views)
2013-05-16 21:24:48

gouessej (72 views)
2013-05-16 00:53:38

gouessej (71 views)
2013-05-16 00:17:58

theagentd (79 views)
2013-05-15 15:01:13

theagentd (74 views)
2013-05-15 15:00:54

StreetDoggy (116 views)
2013-05-14 15:56:26

kutucuk (140 views)
2013-05-12 17:10:36

kutucuk (140 views)
2013-05-12 15:36:09

UnluckyDevil (149 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 21 queries.