1 | import javax.swing.border.*; |
2 | |
3 | static <A extends JComponent> A addInnerMargin(final int top, final int left, final int bottom, final int right, final A c) {
|
4 | if (c != null) swing {
|
5 | Border margin = BorderFactory.createEmptyBorder(top, left, bottom, right); |
6 | c.setBorder(jCompoundBorder(margin, c.getBorder())); |
7 | } |
8 | ret c; |
9 | } |
10 | |
11 | static <A extends JComponent> A addInnerMargin(int w, A c) {
|
12 | ret addInnerMargin(w, w, w, w, c); |
13 | } |
14 | |
15 | static <A extends JComponent> A addInnerMargin(int w, int h, A c) {
|
16 | ret addInnerMargin(h, w, h, w, c); |
17 | } |
Began life as a copy of #1020072
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: | #1020315 |
| Snippet name: | addInnerMargin - add inner margin to JComponent on the inside of border (e.g. a JButton) |
| Eternal ID of this version: | #1020315/3 |
| Text MD5: | 53d4cee96bed4714bafcc43c80d375e1 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-01-06 16:36:51 |
| Source code size: | 558 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 558 / 594 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |