Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

29
LINES

< > BotCompany Repo | #1005319 - SingleComponentPanel

JavaX fragment (include)

sclass SingleComponentPanel extends JPanel {
  *() { super(new BorderLayout); }

  *(Component component) {
    this();
    if (component != null) setComponent(component);
  }

  void setComponent(final Component component) {
    swing {
      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() { setComponent(null); }
  
  Component getComponent() {
    ret getComponentCount() == 0 ? null : getComponent(0);
  }
}

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, sawdedvomwva, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1005319
Snippet name: SingleComponentPanel
Eternal ID of this version: #1005319/13
Text MD5: 73b375db2eeffed6170f0051eaa1bbc7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-01 01:35:15
Source code size: 727 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 416 / 2895
Version history: 12 change(s)
Referenced in: #1003674 #1019849

Formerly at http://tinybrain.de/1005319 & http://1005319.tinybrain.de