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

19
LINES

< > BotCompany Repo | #1030519 // jCenteredSection_fontSizePlus - jSection with centered title

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

Libraryless. Click here for Pure Java version (11812L/66K).

import javax.swing.border.TitledBorder;

static JPanel jCenteredSection_fontSizePlus(int fontPlus, Component etc c) {
  ret jCenteredSection_fontSizePlus(fontPlus, "", c);
}

static JPanel jCenteredSection_fontSizePlus(int fontPlus, S title, Component etc c) {
  ret swing(() -> {
    JPanel p = jCenteredSection(title, c);
    TitledBorder border = cast p.getBorder();
    Font font = border.getTitleFont();
    border.setTitleFont(font.deriveFont(font.getSize2D()+fontPlus));
    ret p;
  });
}

static JPanel jCenteredSection_fontSizePlus(int fontPlus, S title) {
  ret jCenteredSection_fontSizePlus(fontPlus, title, jpanel());
}

Author comment

Began life as a copy of #1020286

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030519
Snippet name: jCenteredSection_fontSizePlus - jSection with centered title
Eternal ID of this version: #1030519/6
Text MD5: 63d60e170bdf5bb6c24dd46a9ef49c86
Transpilation MD5: 7954d04b2c107b190165f39a1e4a1a5a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-13 17:02:18
Source code size: 652 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 253 / 367
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)