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: Fred Chuit on January 19, 2009, 07:55:10 pm



Title: how to make slider with fixed values for instance 1,2,5,10 50
Post by: Fred Chuit on January 19, 2009, 07:55:10 pm
Dear EJS-users,

I am looking for an input device (slider-type) from which a user can pick fixed values,
for instance: 0.1 , 1 , 2, 5, 10, 50, 100.

Is something like this possible in EJS?

Already thanks for any help of advice.
Regards,
Fred


Title: Re: how to make slider with fixed values for instance 1,2,5,10 50
Post by: Fu-Kwun Hwang on January 19, 2009, 08:36:11 pm
It is the same question for all programming language/environment (not restricted to EJS).
It always be possible. But the problem is how to let user understand how to use it easily.

Set up a label on top of a slider to display " 0.1, 1, 2, 5, 10,50,100",
And add a slider under it for integer value property: for example id (range from 0-6 for the above values).
 then add the following code :
switch(id){
 case 0: x=0.1; break;
 case 1: x=1.0; break;
 case 2: x=2.0; break;
....
}
May be you can add another text string to display value for x.

You should be able to find different way to do it.



Title: Re: how to make slider with fixed values for instance 1,2,5,10 50
Post by: lookang on January 20, 2009, 09:23:48 am
it is incredible. cool. amazing