Hello I am new to using java i have figured some stuff out on my own and its cool but one ? i had is this
if the java game (ex. tic tac toe) uses the image X can i change it to a different image like i want to make it a pic of a frog and the other (o) a pic of a diff frog to tie in with my site and if so can i plz acquire this info on how i would do it thank you very much
Changing Applet Values
I'm assuming you're talking about an applet which has parameters that you set in the HTML page script?
Remember, parameters are variables in the html script that usually follow the <applet tag code and use this format:
<param name="any_name" value="some_value">
Keep in mind that the Java code inside the applet_name.class or applet_name.jar file is taking those parameters and using them. So, if you feed the Java code the wrong parameters... LOOKOUT!!! ;-)
You should never mess with the parameter name. It has to be exactly as it is used in an example or readme file. However, what you can change, and what the Java Programmer has given you the option to change, is the VALUE. Again, the applet instructions will tell you what values are acceptable. Sometimes "red" is fine, other times you need to use the code: #FF0000 for the color.
Sometimes applets use jpg but not gif files. I just downloaded one applet sample which stated that the background gif MUST be the same dimensions as the sample!
All this leads to my response, that, if it is a parameter that you are wishing to change, and the VALUE it uses is referring to an image file, then yes, you can change it.
Keep in mind however that you may have to play with:
the image format (bmp, jpg, gif,);
the dimensions (250px x 250px); and also
the directory where it resides:
Hopefully the instructions are well spelled out as to how creative you can get in changing the value portions of a parameter.
In your instance, you may have something that looks like this:
<param name="oimage" value="o.gif">
<param name="ximage" value="x.gif">
Where o.gif and x.gif are in the same folder/directory as the applet.class file.
So all you'd have to do is upload your frog_o.gif and frog_x.gif files to the same folder as your applet; then,
change the coding in your html file to show:
<param name="oimage" value="frog_o.gif">
<param name="ximage" value="frog_x.gif">
Make any sense?
Hope this is of some help to you!
A quick search on JavaBoutique and I found a TicTacToe Applet:
You'll notice that it does not have any parameters in the html script provided. Hmm! Not to worry. You'll note that you are also required to download two image files:
cross.gif and not.gif which go with the applet.
Interestingly, this applet has the java code supplied with it. This particular applet does not allow for image parameters in its code. You must put the images as named above into a folder called 'images' that is in the same directory/folder as the applet.
NOT TO WORRY!!
All you need to do is change the names of your images to cross.gif for the 'x' and not.gif for the 'o'.
Keep in mind, per my prior post, that these MUST be gif files, AND, looking at the image files, they must be
35 x 40 and/or 37 x 49 px. So, roughly if you use gif images that are 40px by 40px, it will probably work okay... but you may have to play with it a bit.
Again, it all depends on the applet and how flexible it is in using external files and the formatting of those files.
Hope this helps!
No actually u lost me after the english lol..this is my first feeble attempt and i am not having a clue what you are talking about but i will refer to your post and try to match things up. thank you for your help though
Jim is saying that this java code unlike many others does not allow user to change the image files so you cannot supply your own images.
But what you can do is to replace the images that came with the original java program with yours.. So when the program starts then istead of loading the original images it will load your images and should work fine.
However there is one slight snag - the difference of size - between original images and your images may cause some erratic behaviour.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center