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

17
LINES

< > BotCompany Repo | #1011115 // centerInternalFrame

JavaX fragment (include)

1  
static JInternalFrame centerInternalFrame(final JInternalFrame f) {
2  
  swing {
3  
    Container c = f.getParent();
4  
    if (c != null) {
5  
      //print("Container type: " + className(c) + ", bounds: " + c.getBounds());
6  
      f.setLocation((c.getWidth()-f.getWidth())/2, (c.getHeight()-f.getHeight())/2);
7  
    }
8  
  }
9  
  ret f;
10  
}
11  
12  
static JInternalFrame centerInternalFrame(final int w, final int h, final JInternalFrame f) {
13  
  swing {
14  
    f.setSize(w, h);
15  
  }
16  
  ret centerInternalFrame(f);
17  
}

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