1 | static void removeFromWindow(Component c) { |
2 | JFrame frame = getFrame(c); |
3 | if (frame == null) ret; |
4 | Container cp = frame.getContentPane(); // This is our BorderLayout |
5 | if (cp != c.getParent()) { print("removeFromWindow fail"); ret; } |
6 | cp.remove(c); |
7 | Container mainC = (Container) cp.getComponents()[0]; |
8 | cp.remove(mainC); |
9 | |
10 | frame.setContentPane(mainC); |
11 | |
12 | // magic combo to actually relayout and repaint |
13 | frame.revalidate(); |
14 | frame.repaint(); |
15 | } |
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: | #1004937 |
Snippet name: | removeFromWindow - opposite of addToWindow |
Eternal ID of this version: | #1004937/1 |
Text MD5: | 6fc8c329f163275f512ead9e588f7e98 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-09-17 19:25:29 |
Source code size: | 469 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 530 / 538 |
Referenced in: | [show references] |