// f: voidfunc(float) static JSlider liveSliderZeroToOne(final float def, fO f) { ret swing(func -> JSlider { final int max = 9999; final JSlider slider = new JSlider(0, max, iround(def*max)); slider.addChangeListener(new ChangeListener { int lastValue = slider.getValue(); public void stateChanged(ChangeEvent e) { int value = slider.getValue(); if (value != lastValue) { lastValue = value; float x = value/(float) max; setToolTip(slider, str(x)); pcallF(f, x); } } }); ret slider; }); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005725 |
Snippet name: | liveSliderZeroToOne |
Eternal ID of this version: | #1005725/5 |
Text MD5: | 5841ca4c09910d7e5e3a0c7bc23865c5 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-10 16:15:25 |
Source code size: | 613 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 569 / 607 |
Version history: | 4 change(s) |
Referenced in: | [show references] |