java - Non continuous slider -
i want have following slider user can select predefined set of values (64, 128, 256, ... 2048) , want able set labels ticks. this:
[--*---------*------------------o--------------] 64 128 256
is there built-in solution or component such non continuous slider?
here javafx-8 (it not applicable jfx-2 because of issue, watch comment below) :
@override public void start(stage stage) throws exception { slider s = new slider(); s.setlabelformatter(new stringconverter<double>() { @override public string tostring(double t) { return string.valueof(math.round(math.pow(2, t))); } @override public double fromstring(string string) { return double.parsedouble(string); } }); s.setmin(0); s.setmax(10); s.setmajortickunit(1); s.setminortickcount(0); s.setsnaptoticks(true); s.setshowticklabels(true); s.setshowtickmarks(true); stage.setscene(new scene(s)); stage.show(); }
but according issue : https://javafx-jira.kenai.com/browse/rt-18448 solution cannot applied until 8.0 release builds.
the trouble that, seems, there no way solve issue using manipulations on left properties. because left properties can manipulate slider linear value changing. logarithmic value changing reached via labelformatter, trick.
there feature on customisation : https://javafx-jira.kenai.com/browse/rt-27863
Comments
Post a Comment