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

11
LINES

< > TinyBrain | #1007373 - frameInnerWidth - set content pane width of a frame

JavaX fragment (include)

static JFrame frameInnerWidth(final int w, Component c) {
  final JFrame frame = getFrame(c);
  if (c != null) swing {
    Container cp = frame.getContentPane();
    Dimension oldSize = cp.getPreferredSize();
    cp.setPreferredSize(new Dimension(w, cp.getHeight()));
    frame.pack();
    cp.setPreferredSize(oldSize);
  }
  ret frame;
}

Author comment

Began life as a copy of #1006252

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

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: 11 / 5
Version history: 3 change(s)
Referenced in: [show]