This is the source code, I hope it can help you understand why garbled
InputStream in = openfired.getInputStream();
int c;
((c = in.read()) != -1) {
try {
StyleConstants.setFontFamily(styles, "courier new");
pane.getDocument().insertString(pane.getDocument().getLength(),
"" + (char)c, styles);
}
catch (BadLocationException e) {
// Ignore.
}
}
in.close();