private void incOrDecFieldValue(KeyEvent e, double x) {
if (!(e.getSource() instanceof TextField)) {
return; // check it's a textField
} // increment or decrement the value
final TextField tf = (TextField) e.getSource();
final Double newValue = Double.valueOf(tf.getText()) + x;
double rounded = round(newValue, roundingFactor);
slider_slider.setValue(rounded);
tf.setText(Double.toString(newValue));
// Avoid using runLater
// This should be done somewhere else (need to investigate)
// Platform.runLater(new Runnable() {
// @Override
// public void run() {
// // position caret after new value for easy editing
// tf.positionCaret(tf.getText().length());
// }
// });
}
GradientSlider.java 文件源码
java
阅读 57
收藏 0
点赞 0
评论 0
项目:fxexperience2
作者:
评论列表
文章目录