Libraryless. Click here for Pure Java version (14849L/87K).
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<Pt>(virtualList(w*h, i -> pt(i%w, i/w))); new Var<Graphics2D> 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); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035209 |
| Snippet name: | testDirectlyPaintingOnJComponent |
| Eternal ID of this version: | #1035209/7 |
| Text MD5: | 4381ae31afd6e53b8c9369862936695c |
| Transpilation MD5: | e4dde5aa3812999df38cc800b6cbcf50 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-04-15 05:27:20 |
| Source code size: | 835 bytes / 33 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 341 / 468 |
| Version history: | 6 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |