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

22
LINES

< > BotCompany Repo | #1004714 // withMargin

JavaX fragment (include)

1  
static int withMargin_defaultWidth = 6;
2  
3  
static JPanel withMargin(Component c) {
4  
  ret withMargin(withMargin_defaultWidth, c);
5  
}
6  
7  
static JPanel withMargin(int w, Component c) {
8  
  ret withMargin(w, w, c);
9  
}
10  
11  
static JPanel withMargin(int w, int h, Component c) {
12  
  ret withMargin(w, h, w, h, c);
13  
}
14  
15  
static JPanel withMargin(final int top, final int left, final int bottom, final int right, final Component c) {
16  
  ret swing(func -> JPanel {
17  
    JPanel p = marginPanel();
18  
    p.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));
19  
    p.add(c);
20  
    ret p;
21  
  });
22  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004714
Snippet name: withMargin
Eternal ID of this version: #1004714/7
Text MD5: 8ac52a56fb34640eb4e1ef2597e0eb04
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:04:15
Source code size: 597 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 800 / 835
Version history: 6 change(s)
Referenced in: [show references]