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

18
LINES

< > BotCompany Repo | #1003285 // withTitle (Swing)

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

Libraryless. Click here for Pure Java version (11425L/64K).

static JComponent withTitle(String title, Component etc c) {
  ret withTitle(withTitle_titlePanel(title), c);
}

static JComponent withTitle_titlePanel(String title) {
  ret jlabel(title);
}

static JPanel withTitle(final JComponent titleComponent, final Component c) {
  ret swing(func -> JPanel {
    titleComponent.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("Button.borderColor")));
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBackground(Color.WHITE);
    panel.add(BorderLayout.NORTH, titleComponent);
    panel.add(BorderLayout.CENTER, wrap(c));
    return panel;
  });
}

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: 644 / 819
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1006929 - withCenteredTitle (Swing)