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

// f: voidfunc(DoubleRange)
static RangeSlider rangeSliderZeroToOne(DoubleRange defRange, O f) {
  ret swing(func -> RangeSlider {
    int max = 9999;
    RangeSlider slider = new RangeSlider(0, max);
    rangeSliderSetZeroToOneDoubleRange(slider, max, defRange);
    slider.addChangeListener(new ChangeListener {
      DoubleRange lastValue = zeroToOneDoubleRangeFromRangeSlider(max, slider);
      public void stateChanged(ChangeEvent e) {
        DoubleRange value = zeroToOneDoubleRangeFromRangeSlider(max, slider);
        if (neq(value, lastValue)) {
          lastValue = value;
          setToolTip(slider, str(value));
          pcallF(f, value);
        }
      }
    });
    ret slider;
  });
}

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