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

33
LINES

< > BotCompany Repo | #1024693 // jCenteredLiveValueSection - jCenteredSection + LiveValue (or IGetterWithNotify)

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

Libraryless. Click here for Pure Java version (9610L/55K).

1  
import javax.swing.border.*;
2  
3  
sclass jCenteredLiveValueSection_class extends SingleComponentPanel {
4  
  IGetterWithNotify<S> liveValue;
5  
  settable int borderType = BevelBorder.LOWERED;
6  
  settable bool bold;
7  
  
8  
  S getTitle() { ret liveValue!; }
9  
  
10  
  *(IGetterWithNotify<S> *liveValue, Component c) {
11  
    super(c);
12  
  }
13  
    
14  
  selfType init() {
15  
    bindLiveValueListenerToComponent(this, liveValue, r-awt {
16  
      var titledBorder = BorderFactory.createTitledBorder(
17  
        makeBaseBorder(), liveValue!);
18  
      if (bold) titledBorder.setTitleFont(deriveBoldFont(getFont()));
19  
      setBorder(titledBorder);
20  
      centerSection(jCenteredLiveValueSection_class.this);
21  
      revalidate();
22  
    });
23  
    this;
24  
  }
25  
  
26  
  swappable Border makeBaseBorder() {
27  
    ret BorderFactory.createBevelBorder(borderType);
28  
  }
29  
}
30  
31  
static JPanel jCenteredLiveValueSection(IGetterWithNotify<S> lv, Component c) swing {
32  
  ret new jCenteredLiveValueSection_class(lv, c).init();
33  
}

Author comment

Began life as a copy of #1015895

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024693
Snippet name: jCenteredLiveValueSection - jCenteredSection + LiveValue (or IGetterWithNotify)
Eternal ID of this version: #1024693/13
Text MD5: 15480dad93d679fef981a2fb4229d7e7
Transpilation MD5: 26a72764707af04d0afa7e0e2008d4ba
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-30 19:53:17
Source code size: 980 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 520
Version history: 12 change(s)
Referenced in: [show references]