private synchronized void writeMessageText(String message) { SimpleAttributeSet attrTS = new SimpleAttributeSet(); attrTS.addAttribute(ColorConstants.Foreground, Color.DARK_GRAY); attrTS.addAttribute(StyleConstants.Bold, true); logMsg.setValue("source", "ccu"); logMsg.setValue("destination", "ccu"); Document doc = msgTextArea.getDocument(); try { SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(ColorConstants.Foreground, Color.blue); doc.insertString(doc.getLength(), "[" + getTimeStamp() + "]: ", attrTS); attr = new SimpleAttributeSet(); attr.addAttribute(ColorConstants.Foreground, Color.black); doc.insertString(doc.getLength(), message + "\n", attr); msgTextArea.setCaretPosition(doc.getLength()); } catch (Exception e) { } }