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

14
LINES

< > BotCompany Repo | #1033923 // tabComponentClickFixer - allow activating tab when clicking nested custom component

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

Transpiled version (4791L) is out of date.

1  
static <A extends JComponent> A tabComponentClickFixer(A c) {
2  
  onMouseDown(c, e -> {
3  
    JTabbedPane tabs = parentOfType(c, JTabbedPane.class);
4  
    if (tabs == null) ret;
5  
    var tabComponents = tabComponents(tabs);
6  
    print ifdef tabComponentClickFixer_debug("Looking for tab for " + c);
7  
    for i over tabComponents:
8  
      if (isGrandChildOf(c, tabComponents.get(i))) {
9  
        print ifdef tabComponentClickFixer_debug("Found tab: " + i);
10  
        ret with selectTab(tabs, i);
11  
      }
12  
  });
13  
  ret c;
14  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033923
Snippet name: tabComponentClickFixer - allow activating tab when clicking nested custom component
Eternal ID of this version: #1033923/8
Text MD5: 353f93ae240abac752fae5b901f9b000
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-30 15:19:02
Source code size: 517 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 209 / 296
Version history: 7 change(s)
Referenced in: [show references]