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 = new JPanel(new BorderLayout);
    p.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));
    p.add(c);
    ret p;
  });
}

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1004714
Snippet name: withMargin
Eternal ID of this version: #1004714/6
Text MD5: f14943b1055af168f1f176bf4d88e045
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-02 21:28:00
Source code size: 612 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 417 / 411
Version history: 5 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1004714 & http://1004714.tinybrain.de