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

38
LINES

< > BotCompany Repo | #1023113 // JTitleAndBulletPoints

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

Libraryless. Click here for Pure Java version (6512L/46K).

sclass JTitleAndBulletPoints implements Swingable {
  S title; // HTML
  new LS bulletPoints; // HTML
  
  transient JLabel label;
  transient JComponent component;
  
  visualize {
    if (component == null)
      component = setMargin(20, label = jTopLabel());
    update();
    ret component;
  }

  void update {
    if (label == null) ret;
    setText(label, jlabel_fixImages(hhtml(
      p(b(unnull(title), style := "font-size: 40px")) +
      ul(map html_prependBullet(bulletPoints),
        style := "list-style-type: none; font-size: 20px", null,
        /* li styles */ style := "margin-bottom: 10px; text-indent: -20px; padding-left: 20px")));
  }
  
  void setTitle(S title) {
    this.title = title;
    update();
  }
  
  void setBulletPoints(LS bulletPoints) {
    this.bulletPoints = bulletPoints;
    update();
  }
  
  void addBulletPoint(S s) {
    this.bulletPoints.add(s);
    update();
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1023113
Snippet name: JTitleAndBulletPoints
Eternal ID of this version: #1023113/7
Text MD5: 489679ed117942f564ec227ad5d01287
Transpilation MD5: 16014117680a54e8eba253fadb243866
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-05 23:22:56
Source code size: 950 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 651
Version history: 6 change(s)
Referenced in: [show references]