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

13
LINES

< > BotCompany Repo | #1020072 // addMargin - add margin to JComponent (using CompoundBorder)

JavaX fragment (include)

import javax.swing.border.*;

static <A extends JComponent> A addMargin(final int top, final int left, final int bottom, final int right, final A c) {
  if (c != null) swing {
    Border margin = BorderFactory.createEmptyBorder(top, left, bottom, right);
    c.setBorder(jCompoundBorder(c.getBorder(), margin));
  }
  ret c;
}

static <A extends JComponent> A addMargin(int w, A c) {
  ret addMargin(w, w, w, w, c);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020072
Snippet name: addMargin - add margin to JComponent (using CompoundBorder)
Eternal ID of this version: #1020072/4
Text MD5: 0f5d41613d31e7fe9257c419193212e7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 01:10:26
Source code size: 431 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 307 / 326
Version history: 3 change(s)
Referenced in: [show references]