Prntln to swing

Is there a library which provides swing_println as follows:

swing_println(x) acts like println(x), except it constructs a Swing frame and prints the data structure out via Swing labels. In particular, for structures that are heavily nested / contains arrays, this would be visually easier to read.

What’s the use case? For the end user, I’d expect a domain-specific rendering to be more appropriate, for debugging I’d wonder whether console/file based output is sufficient (or even better). In both cases, I’d expect type-specific rendering hints/methods to be required - i.e. you probably wouldn’t want a java.net.URL display to be broken down to protocol, host, hashCode,… attributes.

If I really wanted such a thing, I’d probably consider requiring some transformation to a simpler, generic object-level representation, JSON being an obvious candidate. Finding or implementing a Swing widget for rendering JSON objects should be significantly easier than targeting full-fledged Java/Scala objects.

1 Like

This is for debugging.