public void displayMessage(String message, int type) {
        StyledDocument doc = chatWindow.getStyledDocument();
        SimpleAttributeSet keyWord = new SimpleAttributeSet();
        StyleConstants.setForeground(keyWord, Color.BLUE);
        final String finalmessage;
        String prefix = null;
        if (type == 1) {
            StyleConstants.setForeground(keyWord, Color.MAGENTA);
            prefix = "\n[INFO] ";
        } else if (type == 2) {
            StyleConstants.setForeground(keyWord, Color.WHITE);
            prefix = "\n";
        } else if (type == 3) {
            StyleConstants.setForeground(keyWord, Color.BLUE);
            prefix = "\n";
        } else if (type == 4) {
            StyleConstants.setForeground(keyWord, Color.MAGENTA);
            prefix = "[INFO] ";
        } else if (type == 5) {
            StyleConstants.setForeground(keyWord, Color.RED);
            prefix = "\n";
        }
        StyleConstants.setBold(keyWord, true);
        finalmessage = prefix + message;
        try {
            doc.insertString(doc.getLength(), finalmessage, keyWord);
            chatWindow.setCaretPosition(chatWindow.getDocument().getLength());
        } catch (BadLocationException e) {
            Logger.getLogger(ChatGUI.class.getName()).log(Level.SEVERE, null, e);
        }
    }