Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final void messageRoom (String message, Boolean bold, Color color) {
- StyledDocument document = new DefaultStyledDocument();
- SimpleAttributeSet attributes = new SimpleAttributeSet();
- if(bold) {
- attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.TRUE);
- }
- attributes.addAttribute(StyleConstants.CharacterConstants.Foreground, color);
- try {
- document.insertString(document.getLength(), message, attributes);
- } catch (BadLocationException ex) {
- System.out.println("ex");
- }
- chatArea.setStyledDocument(document);
- }
Add Comment
Please, Sign In to add comment