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

20
LINES

< > BotCompany Repo | #1035158 // onSliderValueChanged

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

Libraryless. Click here for Pure Java version (7715L/43K).

static JSlider onSliderValueChanged(JSlider slider, IVF1<Int> onChange) swing {
  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;
}

static JSlider onSliderValueChanged(JSlider slider, Runnable onChange) {
  if (onChange != null)
    onSliderValueChanged(slider, runnableToIVF1(onChange));
  ret slider;
}

Author comment

Began life as a copy of #1031901

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035158
Snippet name: onSliderValueChanged
Eternal ID of this version: #1035158/4
Text MD5: 4d17c722c548c5e0a7096fde55608cee
Transpilation MD5: 132364b94317ddf16fdef13741c9ee08
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-02 22:27:22
Source code size: 612 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 137 / 200
Version history: 3 change(s)
Referenced in: [show references]