static Rect boundsInParent(Component c, Class<? extends Component> parentType) { ret boundsInParent(c, parentOfType(c, parentType)); } static Rect boundsInParent(Component _c, Component parent) { if (_c == null) null; ret swing(func -> Rect { if (_c == parent) ret Rect(0, 0, _c.getWidth(), _c.getHeight()); Rect r = toRect(_c.getBounds()); Component c = _c; while true { c = c.getParent(); if (c == null) null; if (c == parent) ret r; r = translateRect(r, c.getX(), c.getY()); } }); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015371 |
Snippet name: | boundsInParent |
Eternal ID of this version: | #1015371/13 |
Text MD5: | 4ce3fb36296e2bdfe84321255fb80fe8 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-13 23:35:23 |
Source code size: | 561 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 425 / 479 |
Version history: | 12 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |