Libraryless. Click here for Pure Java version (88L/1K/4K).
!747 m { p { JFrame jf = new JFrame("Courier New?"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container cp = jf.getContentPane(); JTextPane pane = new JTextPane(); appendToTextPane(pane, Color.green, "Hello! \n"); appendToTextPane(pane, Color.blue, "World :)\n"); cp.add(new JScrollPane(pane), BorderLayout.CENTER); jf.setSize(400, 300); jf.setVisible(true); } static void appendToTextPane(JTextPane pane, Color color, S text) ctex { Document doc = pane.getStyledDocument(); SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setFontFamily(set, "Courier New"); StyleConstants.setBold(set, true); StyleConstants.setFontSize(set, 14); StyleConstants.setBackground(set, color); doc.insertString(doc.getLength(), text, set); } }
Began life as a copy of #1001522
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
| ID | Author/Program | Comment | Date |
|---|---|---|---|
| 1136 | stefan | ...nnnope. Not on Linux anyway. Where's our pretty font? | 2015-10-21 20:40:35 |
| Snippet ID: | #1001526 |
| Snippet name: | Swing: Courier New? |
| Eternal ID of this version: | #1001526/1 |
| Text MD5: | f9d55af124e9eb2e024350354ceb14bc |
| Transpilation MD5: | e16dd8bd24cf9e3a744c1b574a509cdb |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-10-21 20:39:41 |
| Source code size: | 865 bytes / 29 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1042 / 1115 |
| Referenced in: | [show references] |