NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: ahmedelshfie on July 02, 2010, 06:13:22 pm



Title: Data images in project MetalicConductor
Post by: ahmedelshfie on July 02, 2010, 06:13:22 pm
This simulation design by Francisco Esquembre if you see prof
Have to images inside jar file (PositiveParticle,NegativeParticle)
My ask when i download XML source code and run simulation
I find images work by %images% i try understand but  ???
Can you prof explain this way please
Thanks
I attach jar file


Title: Re: Data images in project MetalicConductor
Post by: lookang on July 02, 2010, 11:35:45 pm
the files are keep in MetalicConductor/PositiveParticle.gif and NegativeParticle.gif

so %images% on the imageset is the way to call ejs to draw images in array.

and in the initialize page for init positives

int sqr = (int) Math.sqrt(positives);
for (int i=0; i < positives; i++) {
  images[ i ] = "./MetalicConductor/PositiveParticle.gif";

i also don't understand fully, but hope that helps



Title: Re: Data images in project MetalicConductor
Post by: ahmedelshfie on July 03, 2010, 12:54:19 am
May i understand some but I'm try do it with my self insert images in data
And run simulation but appear without images.why i don't know  ???


Title: Re: Data images in project MetalicConductor
Post by: Fu-Kwun Hwang on July 03, 2010, 09:01:15 am
For the image GUI elements:

if you provide the filename in the property field. EJS will try to find the file and include it in the jar file when you compile it.

However, if the images are specified by String (as %images% which means string variables with name "images" contain filename)
EJS can not find the file. You need to include those image file manually. (How to add it ? please check out attached file).


Title: Re: Data images in project MetalicConductor
Post by: ahmedelshfie on July 03, 2010, 10:21:35 am
I work by this way too and include images manually after back to view in EJS and insert images
From insert image file but in this project have insert images from variable in model I'm try
Understand this way to insert images.