Libraryless. Click here for Pure Java version (11425L/64K).
1 | static JComponent withTitle(String title, Component etc c) { |
2 | ret withTitle(withTitle_titlePanel(title), c); |
3 | } |
4 | |
5 | static JComponent withTitle_titlePanel(String title) { |
6 | ret jlabel(title); |
7 | } |
8 | |
9 | static JPanel withTitle(final JComponent titleComponent, final Component c) { |
10 | ret swing(func -> JPanel { |
11 | titleComponent.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("Button.borderColor"))); |
12 | JPanel panel = new JPanel(new BorderLayout()); |
13 | panel.setBackground(Color.WHITE); |
14 | panel.add(BorderLayout.NORTH, titleComponent); |
15 | panel.add(BorderLayout.CENTER, wrap(c)); |
16 | return panel; |
17 | }); |
18 | } |
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: | #1003285 |
Snippet name: | withTitle (Swing) |
Eternal ID of this version: | #1003285/3 |
Text MD5: | 561dac7cd60f875e5b717d962e1a2e39 |
Transpilation MD5: | d73bcc6d221217bd514cd86c648ec395 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-30 19:29:45 |
Source code size: | 645 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 740 / 935 |
Version history: | 2 change(s) |
Referenced in: | [show references] |