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

1  
static JComponent jSliderPlusValue(JSlider slider, S unit default "") {
2  
  ret jSliderPlusValue(slider, value -> spaceCombine(n2(value), unit));
3  
}
4  
5  
static JComponent jSliderPlusValue(JSlider slider, IF1<Int, S> renderValue) {
6  
  var lbl = jlabel();
7  
  onChangeAndNow(slider, -> lbl.setText(renderValue.get(slider.getValue())));
8  
  ret centerAndEastWithMargin(slider, lbl);
9  
}

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: 121 / 181
Version history: 4 change(s)
Referenced in: [show references]