static void appendColoredText(JTextPane pane, Color color, S text) ctex { Document doc = pane.getStyledDocument(); SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setFontFamily(set, "Courier"); StyleConstants.setBold(set, true); StyleConstants.setFontSize(set, 14); StyleConstants.setBackground(set, color); doc.insertString(doc.getLength(), text, set); }
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: | 960 / 1000 |
| Referenced in: | [show references] |