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).

1  
static JSlider looselyBindLiveValueToSliderWithFactor(double increment, IVarWithNotify<Double> lv, JSlider slider) {
2  
  onChange(slider, -> lv.set(intFromSlider(slider)/increment));
3  
  bindToComponent(slider, -> {
4  
    Double value = lv!;
5  
    if (value != null)
6  
      setSliderValue(slider, iround(value*increment));
7  
    else
8  
      lv.set(intFromSlider(slider)/increment);
9  
  });
10  
  ret slider;
11  
}

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: 118 / 169
Referenced in: [show references]