Libraryless. Click here for Pure Java version (5726L/32K).
1 | svoid persistSelectedTabAsLiveValue(JTabbedPane tabs, SimpleLiveValue<S> lv) { |
2 | S value = lv!; |
3 | if (value != null) { |
4 | int idx = indexOfTabName(tabs, value); |
5 | printVars ifdef persistSelectedTabAsLiveValue_debug("persistSelectedTabAsLiveValue", +value, +idx); |
6 | if (idx >= 0) |
7 | selectTab(tabs, idx); |
8 | } |
9 | |
10 | onChangeAndNow(tabs, -> { |
11 | S name = getTabTitle(tabs, selectedTabIndex(tabs)); |
12 | lv.set(name); |
13 | printVars ifdef persistSelectedTabAsLiveValue_debug("persistSelectedTabAsLiveValue", +name); |
14 | }); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034039 |
Snippet name: | persistSelectedTabAsLiveValue (only grabs live value once) |
Eternal ID of this version: | #1034039/5 |
Text MD5: | bf51db8e7659d2c656a9c6bca5fbe52b |
Transpilation MD5: | d3b70dfd5c72715ec8604e15f4bba926 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-28 19:46:39 |
Source code size: | 539 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 153 / 237 |
Version history: | 4 change(s) |
Referenced in: | [show references] |