Libraryless. Click here for Pure Java version (5190L/29K).
// sets value to number closest to existing value static <A extends Number> void spinnerSetNumberList(JSpinner spinner, L<A> list) swing { double value = toDouble(spinner.getValue()); spinner.setModel(new SpinnerListModel(list)); setSpinnerValue(spinner, lowestByScoreFunction(list, x -> absDiff(toDouble(x), value))); }
Began life as a copy of #1033691
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034938 |
| Snippet name: | spinnerSetNumberList |
| Eternal ID of this version: | #1034938/3 |
| Text MD5: | ad44dc11f35392b2d74b5ee11ca4a8a8 |
| Transpilation MD5: | baf337f2b0e842eb917c5062b519c56b |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-17 17:10:21 |
| Source code size: | 331 bytes / 6 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 385 / 502 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |