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

17
LINES

< > BotCompany Repo | #1011115 // centerInternalFrame

JavaX fragment (include)

static JInternalFrame centerInternalFrame(final JInternalFrame f) {
  swing {
    Container c = f.getParent();
    if (c != null) {
      //print("Container type: " + className(c) + ", bounds: " + c.getBounds());
      f.setLocation((c.getWidth()-f.getWidth())/2, (c.getHeight()-f.getHeight())/2);
    }
  }
  ret f;
}

static JInternalFrame centerInternalFrame(final int w, final int h, final JInternalFrame f) {
  swing {
    f.setSize(w, h);
  }
  ret centerInternalFrame(f);
}

Author comment

Began life as a copy of #1011114

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011115
Snippet name: centerInternalFrame
Eternal ID of this version: #1011115/8
Text MD5: ef89540c98543566546fab34e1f6b75a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-27 23:08:16
Source code size: 496 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 382 / 437
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)