How to send Serial data received to a text window?

Start here:

The key is that a script that is going to block reading from the serial port (even briefly) must be run in a background thread. Data to deliver to your UI must use system.util.invokeLater() to delegate snippets of code back on the UI thread.