Question

I want a JSlider which has five different value's: 1000 (thousand), 10000 (ten thousand), 100000 (a hundred thousand), 1000000 (one million) and 10000000 (ten million). As you can see, every value is ten times as much as it's predecessor.

Since it isn't possible to set the minorTickSpacing because of it's dynamical value, I was asking how to do the spacing.

Était-ce utile?

La solution

You're going to have to pretend.

Set the slider minimum to 3 and set the slider maximum to 7.

Get your value with the following line of Java code.

double value = Math.pow(10.0D, (double) slider.getValue());
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top