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.

static <A extends JComponent> A tabComponentClickFixer(A c) {
  onMouseDown(c, e -> {
    JTabbedPane tabs = parentOfType(c, JTabbedPane.class);
    if (tabs == null) ret;
    var tabComponents = tabComponents(tabs);
    print ifdef tabComponentClickFixer_debug("Looking for tab for " + c);
    for i over tabComponents:
      if (isGrandChildOf(c, tabComponents.get(i))) {
        print ifdef tabComponentClickFixer_debug("Found tab: " + i);
        ret with selectTab(tabs, i);
      }
  });
  ret c;
}

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