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

static <A> A parentOfType(Component _c, Class<A> theClass) {
  ret swing(() -> {
    Component c = _c;
    while (c != null) {
      if (isInstance(theClass, c)) ret (A) c;
      c = c.getParent();
    }
    null;
  });
}

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