Hi,
Yes, you can although not directly.
use *setLabelTable* for labels (see *createStandardLabels* to understand).
You will need also *setMinimum*, *setMaximum* and
*setMinorTickSpacing*(with value 1).
Now, about "real values". You can disconnect your ticks values from "labels"
with a vector. So, don't use directly value from JSlider but instead values
from your vector (which is dynamic). Code in which you are interested is in
red.

Code (must be tested, hope is correct)

   //put values in vector
    Vector<Integer> dynArray = new Vector<Integer>();
    //here your function must complete the dynamic values
    dynArray.add(1);
    dynArray.add(3);
    dynArray.add(6);
    dynArray.add(10);

    Hashtable<Integer,JLabel> dictionary = new Hashtable<Integer,JLabel>();
    for(int i = 0; i < dynArray.size(); i++){
        dictionary.put(dynArray.get(i), new
JLabel(dynArray.get(i).toString()));
    }

    JSlider jsl = new JSlider();//here you have your slider
    jsl.setMinimum(0);//0
    jsl.setMaximum(dynArray.size()-1);//3 in this case
    jsl.setMinorTickSpacing(1);
    jsl.setLabelTable(dictionary);//here "labels" are different from values

    ......
    //when reading the Slider don't use JSlider value but convert it from
Vector
    int realValue = dynArray.get(jsl.getValue());//{1,3,6,10};

P.S. Don't forget to empty *dynArray* and *dictionary* before reusing if
they are global in class. Sometimes, now rarely I forget also.

Best regards,
Vasile Braileanu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to