// f: voidfunc(float) static JSlider liveSliderZeroToX(final float maxValue, final float def, fO f) { ret swing(func -> JSlider { final int max = 10000; final float factor = max/maxValue; final JSlider slider = new JSlider(0, max, iround(def*factor)); 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/factor; setToolTip(slider, str(x)); pcallF(f, x); } } }); ret slider; }); }
Began life as a copy of #1005725
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018694 |
Snippet name: | liveSliderZeroToX |
Eternal ID of this version: | #1018694/1 |
Text MD5: | 7be2a3311b9e0bcb60710fe054a40e2f |
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:16:51 |
Source code size: | 672 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 288 / 323 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |