static JSlider liveSlider(int min, int max, int value, IVF1 onChange) { ret swing(() -> { JSlider slider = new JSlider(min, max, value); slider.addChangeListener(new ChangeListener { int lastValue = slider.getValue(); public void stateChanged(ChangeEvent e) { int value = slider.getValue(); if (value != lastValue) { lastValue = value; setToolTip(slider, str(value)); pcallF(onChange, value); } } }); ret slider; }); }