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

9
LINES

< > BotCompany Repo | #1030810 // jMinWidthAtLeast - set minimum width of Swing component

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2915L/17K).

1  
static <A extends Component> A jMinWidthAtLeast(int w, final A c) {
2  
  if (c == null) null;
3  
  ret swing(func -> A {
4  
    Dimension size = c.getMinimumSize();
5  
    Dimension d = new Dimension(max(w, size.width), size.height);
6  
    c.setMinimumSize(d);
7  
    ret jPreferWidth(d.width, c);
8  
  });
9  
}

Author comment

Began life as a copy of #1005391

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030810
Snippet name: jMinWidthAtLeast - set minimum width of Swing component
Eternal ID of this version: #1030810/3
Text MD5: b53abe2514447a8006faa37041af338f
Transpilation MD5: 2dc7df2129049be0c476b2092b6f9096
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-28 19:27:34
Source code size: 296 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 200 / 304
Version history: 2 change(s)
Referenced in: [show references]