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

21
LINES

< > BotCompany Repo | #1016951 // jCenteredSection - jSection with centered title

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

Libraryless. Click here for Pure Java version (3999L/24K).

import javax.swing.border.TitledBorder;

static JPanel jCenteredSection(Component c) {
  ret jCenteredSection("", c);
}

static JPanel jCenteredSection(S title, Swingable c) {
  ret jCenteredSection(title, wrap(c));
}

static JPanel jCenteredSection(S title, Component c) {
  ret swing(func -> JPanel {
    JPanel p = jSection(title, c);
    ((TitledBorder) p.getBorder()).setTitleJustification(TitledBorder.CENTER);
    ret p;
  });
}

static JPanel jCenteredSection(S title) {
  ret jCenteredSection(title, jpanel());
}

Author comment

Began life as a copy of #1006228

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016951
Snippet name: jCenteredSection - jSection with centered title
Eternal ID of this version: #1016951/4
Text MD5: 48890f842bf8a4021d01be10bc821fa9
Transpilation MD5: 2b0c6734ef7b1d448ed0d203976ae15a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-19 16:37:18
Source code size: 543 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 448 / 534
Version history: 3 change(s)
Referenced in: [show references]