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

18
LINES

< > BotCompany Repo | #1010136 // withLeftAndRightMargin

JavaX fragment (include)

1  
static int withLeftAndRightMargin_defaultWidth = 6;
2  
3  
static JPanel withLeftAndRightMargin(Component c) {
4  
  ret withLeftAndRightMargin(withLeftAndRightMargin_defaultWidth, c);
5  
}
6  
7  
static JPanel withLeftAndRightMargin(int w, Component c) {
8  
  ret withLeftAndRightMargin(w, w, c);
9  
}
10  
11  
static JPanel withLeftAndRightMargin(final int w1, final int w2, final Component c) {
12  
  ret swing(func -> JPanel {
13  
    JPanel p = marginPanel();
14  
    p.setBorder(BorderFactory.createEmptyBorder(0, w1, 0, w2));
15  
    p.add(c);
16  
    ret p;
17  
  });
18  
}

Author comment

Began life as a copy of #1007247

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010136
Snippet name: withLeftAndRightMargin
Eternal ID of this version: #1010136/6
Text MD5: dc58aa4a4677be799f59a826a6f9b65c
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-29 03:36:00
Source code size: 539 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 468 / 524
Version history: 5 change(s)
Referenced in: [show references]