Libraryless. Click here for Pure Java version (5190L/29K).
1 | // sets value to number closest to existing value |
2 | static <A extends Number> void spinnerSetNumberList(JSpinner spinner, L<A> list) swing { |
3 | double value = toDouble(spinner.getValue()); |
4 | spinner.setModel(new SpinnerListModel(list)); |
5 | setSpinnerValue(spinner, lowestByScoreFunction(list, x -> absDiff(toDouble(x), value))); |
6 | } |
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: | 164 / 234 |
Version history: | 2 change(s) |
Referenced in: | [show references] |