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)

static <A extends JComponent> A onFirstComponentShow(final A component, final Runnable onShow) {
  swing {
    component.addAncestorListener(new AncestorListener {
      public void ancestorAdded(AncestorEvent event) {
        component.removeAncestorListener(this);
        pcallF(onShow);
      }
      public void ancestorRemoved(AncestorEvent event) {}
      public void ancestorMoved(AncestorEvent event) {}
    });
  }
  ret component;
}

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: 298 / 320
Version history: 1 change(s)
Referenced in: [show references]