svoid testDirectlyPaintingOnJComponent(int w default 256) { int h = w; var c = //jcenteredlabel("Bla"); new JComponent {}; setOpaqueBackground(Color.white, c); jMinSize(c, w, h); var it = WeightlessShuffledIteratorWithSeed(virtualList(w*h, i -> pt(i%w, i/w))); new Var g; new Flag done; double timeToFinish = 2; // seconds int pixelsPerMS = iceilRatio(w*h/100, timeToFinish); awtEvery(c, 10, -> { if (!g.has()) { g.set((Graphics2D) c.getGraphics()); if (!g.has()) ret; } repeat pixelsPerMS { if (!it.hasNext()) { if (done.raise()) print("Done painting " + nPixels(w*h)); break; } var p = it.next(); //print(+p); setPixel(g!, p, Color.black); } }); showFrame(c); }