Uses 3874K of libraries. Click here for Pure Java version (5921L/42K/149K).
1 | !7 |
2 | |
3 | static int delay = 500; |
4 | |
5 | p-substance { |
6 | final new ImageSurface is; |
7 | // is.noMinimumSize = true; // now default |
8 | showFrame(is); // no scroll pane |
9 | |
10 | print(is.getSize()); // should already be the window's inner size |
11 | |
12 | onResizeAndNow(is, r { |
13 | print("component resized. " + is.getSize()); |
14 | awtLater(is, delay, r { |
15 | BufferedImage img = is.getImage(); |
16 | if (img.getWidth() != is.getWidth() || img.getHeight() != is.getHeight()) |
17 | is.setImage(makeImage(is.getWidth(), is.getHeight())); |
18 | }); |
19 | }); |
20 | } |
21 | |
22 | static BufferedImage makeImage(final int w, final int h) { |
23 | ret renderImage(w, h, func(int x, int y) { |
24 | ret x < w/2 != y < h/2; |
25 | }); |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007280 |
Snippet name: | Test Adapting ImageSurface To Window Size [WORKS] |
Eternal ID of this version: | #1007280/12 |
Text MD5: | 45cc3966708f1fe09758d1a26569ecb3 |
Transpilation MD5: | dc855cb229c17694a76c366964fdb574 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-14 22:30:58 |
Source code size: | 691 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 451 / 571 |
Version history: | 11 change(s) |
Referenced in: | [show references] |