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

9
LINES

< > BotCompany Repo | #1035781 // jSliderPlusValue - display numerical value next to slider

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

Libraryless. Click here for Pure Java version (11096L/62K).

static JComponent jSliderPlusValue(JSlider slider, S unit default "") {
  ret jSliderPlusValue(slider, value -> spaceCombine(n2(value), unit));
}

static JComponent jSliderPlusValue(JSlider slider, IF1<Int, S> renderValue) {
  var lbl = jlabel();
  onChangeAndNow(slider, -> lbl.setText(renderValue.get(slider.getValue())));
  ret centerAndEastWithMargin(slider, lbl);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035781
Snippet name: jSliderPlusValue - display numerical value next to slider
Eternal ID of this version: #1035781/5
Text MD5: 810bfb263579d243785b21c365f05069
Transpilation MD5: 988ee2a337a03e9eeab85918fe9d2253
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-25 18:16:32
Source code size: 378 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 61 / 104
Version history: 4 change(s)
Referenced in: [show references]