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

10
LINES

< > BotCompany Repo | #1026598 // htmlForJLabel_chatConvo (old version with divs)

JavaX fragment (include)

// 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" : ""));
  }));
}

Author comment

Began life as a copy of #1026592

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: #1026598
Snippet name: htmlForJLabel_chatConvo (old version with divs)
Eternal ID of this version: #1026598/1
Text MD5: 832b1e1b72ce465c0717b0abd8e3e0e9
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-15 14:50:24
Source code size: 502 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 116 / 143
Referenced in: [show references]