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: | 372 / 391 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1020074 - addBottomMargin - add bottom margin to JComponent (using CompoundBorder) #1020315 - addInnerMargin - add inner margin to JComponent on the inside of border (e.g. a JButton) |