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

10
LINES

< > BotCompany Repo | #1007191 // parentOfType

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

Libraryless. Click here for Pure Java version (2655L/17K).

1  
static <A> A parentOfType(Component _c, Class<A> theClass) {
2  
  ret swing(() -> {
3  
    Component c = _c;
4  
    while (c != null) {
5  
      if (isInstance(theClass, c)) ret (A) c;
6  
      c = c.getParent();
7  
    }
8  
    null;
9  
  });
10  
}

Author comment

Began life as a copy of #1006619

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1007191
Snippet name: parentOfType
Eternal ID of this version: #1007191/5
Text MD5: 1dc174226bf1569feef427fda2eae430
Transpilation MD5: db0ac5de9a47604b4beb693d08a3e421
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-19 14:56:19
Source code size: 230 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 540 / 639
Version history: 4 change(s)
Referenced in: [show references]