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

22
LINES

< > BotCompany Repo | #1004714 // withMargin

JavaX fragment (include)

static int withMargin_defaultWidth = 6;

static JPanel withMargin(Component c) {
  ret withMargin(withMargin_defaultWidth, c);
}

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

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

static JPanel withMargin(final int top, final int left, final int bottom, final int right, final Component c) {
  ret swing(func -> JPanel {
    JPanel p = marginPanel();
    p.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));
    p.add(c);
    ret p;
  });
}

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: 728 / 767
Version history: 6 change(s)
Referenced in: [show references]