JSpinner is required to enter only numerical input, it takes some hack for it in its model, but your second. the image looks like two JButtons (with JButton # setFocucPainted (false)) and one JFormattedTextField with the Format number, with min / maxDecimalPaces, with roundingMode
myDoubleFormat.setMinimumFractionDigits(2); myDoubleForma.setMaximumFractionDigits(2); myDoubleForma.setRoundingMode(RoundingMode.HALF_UP);
then Action from JButton will be
myFtdTextField.setValue(((Number) myFtdTextField.getValue()).doubleValue() +/- 0.1)
mKorbel
source share