!7 sclass LockMatrix > DynModule { transient int n; transient BitSet data; transient JComponent canvas; JComponent visualize() { ret awtEvery(canvas = JComponent() { public void paint(Graphics2D g) { int w = getWidth(), h = getHeight(); int rows = ifloor(sqrt(n)); if (rows == 0) fillRect(g, 0, 0, w, h, Color.white); int cols = (n+rows-1)/rows; L tiles = tileRects(w, h, cols, rows); for i over tiles: fillRect(g, tiles.get(i), main.contains(data, i) ? Color.red : Color.black); } }, 1000, r updateMe); } void update { new BitSet bs; L l = dm_listModules(); for i over l: if (getLockOwner((Lock) get(l, 'lock)) != null) bs.set(i); setFields(n := l(l), data := bs); repaint(canvas); } }