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

9
LINES

< > BotCompany Repo | #1004888 // appendColoredText (to JTextPane!)

JavaX fragment (include)

1  
static void appendColoredText(JTextPane pane, Color color, S text) ctex {
2  
  Document doc = pane.getStyledDocument();
3  
  SimpleAttributeSet set = new SimpleAttributeSet();
4  
  StyleConstants.setFontFamily(set, "Courier");
5  
  StyleConstants.setBold(set, true);
6  
  StyleConstants.setFontSize(set, 14);
7  
  StyleConstants.setBackground(set, color);
8  
  doc.insertString(doc.getLength(), text, set);
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004888
Snippet name: appendColoredText (to JTextPane!)
Eternal ID of this version: #1004888/1
Text MD5: 1cd7adcd707867024b782d5e1e9e8b2d
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-13 06:08:30
Source code size: 395 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 730 / 765
Referenced in: [show references]