Skip to content

Commit 84d7c3d

Browse files
committed
更新Readme下载地址。
1 parent ae72569 commit 84d7c3d

2 files changed

Lines changed: 35 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Mac OS X x64 [xJavaFxTool-0.1.6-macosx-x64.pkg](https://dev.tencent.com/s/c5ffd1
2727

2828
若上面下链接失效可使用下面下载链接:
2929

30-
百度云链接:[https://pan.baidu.com/s/1SNXDUBRTXmGamOTt-yJ9mQ](https://pan.baidu.com/s/1SNXDUBRTXmGamOTt-yJ9mQ) 提取码:wy0x
30+
百度云链接:[https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA](https://pan.baidu.com/s/193fhGnJL4dDWcqDnFJcHbA) 提取码:mokl
3131

32-
腾讯微云链接:[https://share.weiyun.com/5BQYuCA](https://share.weiyun.com/5BQYuCA)
32+
腾讯微云链接:[https://share.weiyun.com/5T6FPLW](https://share.weiyun.com/5T6FPLW) 提取码:java
3333

3434
支持插件开发,将插件jar包放至根目录libs下即可自动加载(插件开发示例见[开源项目xJavaFxPlugIn](https://gitee.com/xwintop/xJavaFxPlugIn),后续准备将小工具拆分至各插件中按需加载);
3535

src/main/java/com/xwintop/xJavaFxTool/utils/JavaFxViewUtil.java

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javafx.scene.control.MenuItem;
1616
import javafx.scene.control.*;
1717
import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory;
18+
import javafx.scene.control.SpinnerValueFactory.DoubleSpinnerValueFactory;
1819
import javafx.scene.control.TableColumn.CellEditEvent;
1920
import javafx.scene.control.cell.MapValueFactory;
2021
import javafx.scene.control.cell.TextFieldListCell;
@@ -161,14 +162,38 @@ public static void setSpinnerValueFactory(Spinner<Integer> spinner, int min, int
161162
setSpinnerValueFactory(spinner, min, max, initialValue, 1);
162163
}
163164

164-
public static void setSpinnerValueFactory(Spinner<Integer> spinner, int min, int max, int initialValue,
165-
int amountToStepBy) {
166-
IntegerSpinnerValueFactory secondStart_0svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max,
167-
initialValue, amountToStepBy);
168-
spinner.setValueFactory(secondStart_0svf);
169-
spinner.getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
170-
spinner.getValueFactory().setValue(Integer.parseInt(newValue));
171-
});
165+
public static void setSpinnerValueFactory(Spinner<Double> spinner, double min, double max) {
166+
setSpinnerValueFactory(spinner, min, max, min, 1d);
167+
}
168+
169+
public static void setSpinnerValueFactory(Spinner<Double> spinner, double min, double max, double initialValue) {
170+
setSpinnerValueFactory(spinner, min, max, initialValue, 1d);
171+
}
172+
173+
public static void setSpinnerValueFactory(Spinner spinner, Number min, Number max, Number initialValue, Number amountToStepBy) {
174+
if (min instanceof Integer) {
175+
IntegerSpinnerValueFactory secondStart_0svf = new IntegerSpinnerValueFactory((int) min, (int) max, (int) initialValue, (int) amountToStepBy);
176+
spinner.setValueFactory(secondStart_0svf);
177+
spinner.getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
178+
try {
179+
spinner.getValueFactory().setValue(Integer.parseInt(newValue));
180+
} catch (Exception e) {
181+
log.warn("数字int转换异常 newValue:" + newValue);
182+
spinner.getEditor().setText(oldValue);
183+
}
184+
});
185+
} else if (min instanceof Double) {
186+
DoubleSpinnerValueFactory secondStart_0svf = new DoubleSpinnerValueFactory((double) min, (double) max, (double) initialValue, (double) amountToStepBy);
187+
spinner.setValueFactory(secondStart_0svf);
188+
spinner.getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
189+
try {
190+
spinner.getValueFactory().setValue(Double.parseDouble(newValue));
191+
} catch (Exception e) {
192+
log.warn("数字double转换异常 newValue:" + newValue);
193+
spinner.getEditor().setText(oldValue);
194+
}
195+
});
196+
}
172197
}
173198

174199
/**

0 commit comments

Comments
 (0)