Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1036174 // looselyBindLiveValueToSliderWithFactor - only grab once upon display, but save on every user interaction

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9777L/54K).

static JSlider looselyBindLiveValueToSliderWithFactor(double increment, IVarWithNotify<Double> lv, JSlider slider) {
  onChange(slider, -> lv.set(intFromSlider(slider)/increment));
  bindToComponent(slider, -> {
    Double value = lv!;
    if (value != null)
      setSliderValue(slider, iround(value*increment));
    else
      lv.set(intFromSlider(slider)/increment);
  });
  ret slider;
}

Author comment

Began life as a copy of #1035998

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036174
Snippet name: looselyBindLiveValueToSliderWithFactor - only grab once upon display, but save on every user interaction
Eternal ID of this version: #1036174/1
Text MD5: b0575cf9b6025393e96233fb5efb177e
Transpilation MD5: 2de0b01830785adf09ffc19c5d07d03f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-04 20:26:05
Source code size: 401 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 62 / 87
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)