Libraryless. Click here for Pure Java version (6512L/46K).
1 | sclass JTitleAndBulletPoints implements Swingable { |
2 | S title; // HTML |
3 | new LS bulletPoints; // HTML |
4 | |
5 | transient JLabel label; |
6 | transient JComponent component; |
7 | |
8 | visualize { |
9 | if (component == null) |
10 | component = setMargin(20, label = jTopLabel()); |
11 | update(); |
12 | ret component; |
13 | } |
14 | |
15 | void update { |
16 | if (label == null) ret; |
17 | setText(label, jlabel_fixImages(hhtml( |
18 | p(b(unnull(title), style := "font-size: 40px")) + |
19 | ul(map html_prependBullet(bulletPoints), |
20 | style := "list-style-type: none; font-size: 20px", null, |
21 | /* li styles */ style := "margin-bottom: 10px; text-indent: -20px; padding-left: 20px"))); |
22 | } |
23 | |
24 | void setTitle(S title) { |
25 | this.title = title; |
26 | update(); |
27 | } |
28 | |
29 | void setBulletPoints(LS bulletPoints) { |
30 | this.bulletPoints = bulletPoints; |
31 | update(); |
32 | } |
33 | |
34 | void addBulletPoint(S s) { |
35 | this.bulletPoints.add(s); |
36 | update(); |
37 | } |
38 | } |
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: | 307 / 798 |
Version history: | 6 change(s) |
Referenced in: | [show references] |