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

13
LINES

< > BotCompany Repo | #1019408 // onFirstComponentShow - do something on first showing of component

JavaX fragment (include)

1  
static <A extends JComponent> A onFirstComponentShow(final A component, final Runnable onShow) {
2  
  swing {
3  
    component.addAncestorListener(new AncestorListener {
4  
      public void ancestorAdded(AncestorEvent event) {
5  
        component.removeAncestorListener(this);
6  
        pcallF(onShow);
7  
      }
8  
      public void ancestorRemoved(AncestorEvent event) {}
9  
      public void ancestorMoved(AncestorEvent event) {}
10  
    });
11  
  }
12  
  ret component;
13  
}

Author comment

Began life as a copy of #1003557

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1019408
Snippet name: onFirstComponentShow - do something on first showing of component
Eternal ID of this version: #1019408/2
Text MD5: 1de530632d94b05d8696ce0cb6348671
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-05 01:07:37
Source code size: 455 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 429 / 450
Version history: 1 change(s)
Referenced in: [show references]