1 | static Rectangle boundsOnScreen(Component c) { |
2 | if (c == null) null; |
3 | if (c.getParent() instanceof JViewport |
4 | && c.getParent().getParent() instanceof JScrollPane) |
5 | c = c.getParent().getParent(); |
6 | try { |
7 | ret new Rectangle(c.getLocationOnScreen(), c.getSize()); |
8 | } catch (IllegalComponentStateException e) { |
9 | null; |
10 | } |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003584 |
Snippet name: | boundsOnScreen - get actual bounds of JComponent on screen (honoring a possible scroll pane) |
Eternal ID of this version: | #1003584/2 |
Text MD5: | c30748f3d60a78961f317f3698477c6b |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-10 16:05:16 |
Source code size: | 345 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 599 / 726 |
Version history: | 1 change(s) |
Referenced in: | [show references] |