Transpiled version (7066L) is out of date.
sclass SingleComponentPanel extends JPanel { *() { super(new BorderLayout); } *(Component component) { this(); if (component != null) setComponent(component); } void set(Swingable component) { set(wrap(component)); } void setComponent aka set(Component component) { swing { if (getComponent() == component) ret; removeAll(); if (component != null) add(BorderLayout.CENTER, wrap(component)); _revalidate(SingleComponentPanel.this); } } // Sometimes we need this? void setComponentAndRevalidateParent(Component component) { setComponent(component); _revalidate(_getParent(this)); } void noComponent aka clear() { setComponent(null); } Component getComponent aka get() { ret swing( -> getComponentCount() == 0 ? null : getComponent(0)); } bool isEmpty() { ret getComponent() == null; } bool hasComponent() { ret getComponent() != null; } }
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005319 |
Snippet name: | SingleComponentPanel |
Eternal ID of this version: | #1005319/21 |
Text MD5: | 101946a9ed62ae2d9d02ee6444873bf9 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-03 23:50:02 |
Source code size: | 991 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 822 / 5759 |
Version history: | 20 change(s) |
Referenced in: | [show references] |