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

20
LINES

< > BotCompany Repo | #1024535 // rangeSliderZeroToOne

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

Libraryless. Click here for Pure Java version (2950L/19K).

1  
// f: voidfunc(DoubleRange)
2  
static RangeSlider rangeSliderZeroToOne(DoubleRange defRange, O f) {
3  
  ret swing(func -> RangeSlider {
4  
    int max = 9999;
5  
    RangeSlider slider = new RangeSlider(0, max);
6  
    rangeSliderSetZeroToOneDoubleRange(slider, max, defRange);
7  
    slider.addChangeListener(new ChangeListener {
8  
      DoubleRange lastValue = zeroToOneDoubleRangeFromRangeSlider(max, slider);
9  
      public void stateChanged(ChangeEvent e) {
10  
        DoubleRange value = zeroToOneDoubleRangeFromRangeSlider(max, slider);
11  
        if (neq(value, lastValue)) {
12  
          lastValue = value;
13  
          setToolTip(slider, str(value));
14  
          pcallF(f, value);
15  
        }
16  
      }
17  
    });
18  
    ret slider;
19  
  });
20  
}

Author comment

Began life as a copy of #1005725

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024535
Snippet name: rangeSliderZeroToOne
Eternal ID of this version: #1024535/1
Text MD5: a19c3ecb5e3f4794532f36357139ae27
Transpilation MD5: b51d95f7a74ff0b6ed7c9eb59e3ca789
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-17 16:59:19
Source code size: 724 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 255 / 348
Referenced in: [show references]