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

16
LINES

< > BotCompany Repo | #1009883 // centerWindow

JavaX fragment (include)

static Window centerWindow(Component c) {
  Window w = getWindow(c);
  if (w != null)
    w.setLocationRelativeTo(null); // magic trick
  ret w;
}

static Window centerWindow(Component c, int width, int height) {
  setWindowSize(c, width, height);
  ret centerWindow(c);
}

static JWindow centerWindow(JWindow w) {
  centerWindow(getRootPane(w));
  ret w;
}

Author comment

Began life as a copy of #1001308

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: #1009883
Snippet name: centerWindow
Eternal ID of this version: #1009883/4
Text MD5: e0ac975aa2577cad710db7fb063a7fd2
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-02 23:26:17
Source code size: 372 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 381 / 417
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)