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

15
LINES

< > BotCompany Repo | #1007450 // withTopAndBottomMargin

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5162L/28K).

static int withTopAndBottomMargin_defaultWidth = 6;

static JPanel withTopAndBottomMargin(Component c) {
  ret withTopAndBottomMargin(withTopAndBottomMargin_defaultWidth, withTopAndBottomMargin_defaultWidth, c);
}

static JPanel withTopAndBottomMargin(int topMargin, int bottomMargin, Component c) {
  ret swing(-> {
    JPanel p = new JPanel(new BorderLayout);
    int w = withTopAndBottomMargin_defaultWidth;
    p.setBorder(BorderFactory.createEmptyBorder(topMargin, 0, bottomMargin, 0));
    p.add(c);
    ret p;
  });
}

Author comment

Began life as a copy of #1004959

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007450
Snippet name: withTopAndBottomMargin
Eternal ID of this version: #1007450/5
Text MD5: e00afb31b7402501a8bcb13e8563bdd3
Transpilation MD5: 6af5b5520a7fccd45940b703bc9edcb7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-29 01:06:07
Source code size: 538 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 489 / 512
Version history: 4 change(s)
Referenced in: [show references]