srecord noeq G22ResultVisualizer(G22Utils g22utils) { settable bool withTypeAndTime = true; JComponent visualize(O result, long nanos) { JComponent c; S type; try { c = visualize2(result); if (withTypeAndTime) type = shortClassName(resultType); } catch e { c = jErrorView(e); type = "Error"; } if (withTypeAndTime) { S timeDesc = formatElapsedTimeWithAppropriateUnit(nanosToSeconds(nanos)); c = northAndCenterWithMargins( westAndEastWithMargin( withLabel("Result type:", jlabel(type)), withLabel("Execution time:", jlabel(timeDesc)), ), c); } ret c; } JComponent visualize2(O result) { if (result cast Throwable) ret jErrorView(result); if (result == null || eq(result, "")) ret jpanel(); if (result cast Int) result = toLong(result); if (result cast Long) ret fontSizePlus(10, jcenteredLabel(n2(result))); if (result cast Number) ret fontSizePlus(10, jcenteredLabel(str(result))); if (result cast MakesBufferedImage) result = toBufferedImage(result); if (result cast BufferedImage) ret jscroll_centered_borderless(g22utils.stdImageSurface(result)); ret jcenteredlabel(shorten(str(result))); } }