java - JavaFX Tableview limit the number of digits after point -



java - JavaFX Tableview limit the number of digits after point -

i have table based on tableview , populated double values recieve trougth api , , want display 3 digits after point.

use stringconverter desired format, , install it, using textfieldtablecell this:

threedigitcolumn.setcellfactory(textfieldtablecell.<rowmodel, double>fortablecolumn(new stringconverter<double>() { private final numberformat nf = numberformat.getnumberinstance(); { nf.setmaximumfractiondigits(3); nf.setminimumfractiondigits(3); } @override public string tostring(final double value) { homecoming nf.format(value); } @override public double fromstring(final string s) { // don't need this, unless table editable, see doublestringconverter if needed homecoming null; } }));

java javafx tableview

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -