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

18
LINES

< > BotCompany Repo | #1010136 // withLeftAndRightMargin

JavaX fragment (include)

static int withLeftAndRightMargin_defaultWidth = 6;

static JPanel withLeftAndRightMargin(Component c) {
  ret withLeftAndRightMargin(withLeftAndRightMargin_defaultWidth, c);
}

static JPanel withLeftAndRightMargin(int w, Component c) {
  ret withLeftAndRightMargin(w, w, c);
}

static JPanel withLeftAndRightMargin(final int w1, final int w2, final Component c) {
  ret swing(func -> JPanel {
    JPanel p = marginPanel();
    p.setBorder(BorderFactory.createEmptyBorder(0, w1, 0, w2));
    p.add(c);
    ret p;
  });
}

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: 541 / 597
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)