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

11
LINES

< > BotCompany Repo | #1007373 // frameInnerWidth - set content pane width of a frame

JavaX fragment (include)

1  
static JFrame frameInnerWidth(final int w, Component c) {
2  
  final JFrame frame = getFrame(c);
3  
  if (c != null) swing {
4  
    Container cp = frame.getContentPane();
5  
    Dimension oldSize = cp.getPreferredSize();
6  
    cp.setPreferredSize(new Dimension(w, cp.getHeight()));
7  
    frame.pack();
8  
    cp.setPreferredSize(oldSize);
9  
  }
10  
  ret frame;
11  
}

Author comment

Began life as a copy of #1006252

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: #1007373
Snippet name: frameInnerWidth - set content pane width of a frame
Eternal ID of this version: #1007373/4
Text MD5: 2720b0db62125ba8aab459d55d29d959
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-18 14:26:16
Source code size: 348 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 444 / 464
Version history: 3 change(s)
Referenced in: [show references]