Author Topic: how to make slider with fixed values for instance 1,2,5,10 50  (Read 8539 times)

Fred Chuit

  • Newbie
  • *
  • Posts: 18
how to make slider with fixed values for instance 1,2,5,10 50
« on: January 19, 2009, 08: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

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: how to make slider with fixed values for instance 1,2,5,10 50
« Reply #1 on: January 19, 2009, 09:36:11 pm »
Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME

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.



Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME

lookang

  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: how to make slider with fixed values for instance 1,2,5,10 50
« Reply #2 on: January 20, 2009, 10:23:48 am »
it is incredible. cool. amazing