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

10
LINES

< > BotCompany Repo | #1026592 // htmlForJLabel_chatConvo

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

Libraryless. Click here for Pure Java version (2580L/17K).

// use inside of jAutoWidthHTMLLabel
// pairs: (HTML text, false=left/true=right)
// sadly, no padding possible with this div/span arrangement
sS htmlForJLabel_chatConvo(LPair<S, Bool> dialog) {
  ret lines(mapPairsToList(dialog, (content, right) -> {
    S color = right ? "#9999FF" : "#99FF99";
    ret div(span(content, style := "background: \*color*/"),
      style := "margin-bottom: 10px; margin-" + (right ? "left" : "right") + ": 20px" + (right ? "; text-align: right" : ""));
  }));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026592
Snippet name: htmlForJLabel_chatConvo
Eternal ID of this version: #1026592/9
Text MD5: 832b1e1b72ce465c0717b0abd8e3e0e9
Transpilation MD5: f292c1f9a0da8a972a11e319b33c43f3
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-15 14:38:33
Source code size: 502 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 224 / 337
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026598 - htmlForJLabel_chatConvo (old version with divs)
#1026599 - htmlForJLabel_chatConvo_table