Libraryless. Click here for Pure Java version (7203L/42K).
1 | static JLabel setImage(final BufferedImage img, final JLabel lbl) { |
2 | if (lbl != null) swing { lbl.setIcon(imageIcon(img)); } |
3 | ret lbl; |
4 | } |
5 | |
6 | static JLabel setImage(JLabel lbl, BufferedImage img) { |
7 | ret setImage(img, lbl); |
8 | } |
9 | |
10 | static JLabel setImage(final S imageID, final JLabel lbl) { |
11 | if (lbl != null) swing { lbl.setIcon(imageIcon(imageID)); } |
12 | ret lbl; |
13 | } |
14 | |
15 | static JLabel setImage(JLabel lbl, S imageID) { |
16 | ret setImage(imageID, lbl); |
17 | } |
18 | |
19 | ifclass ImageSurface |
20 | static <A extends ImageSurface> A setImage(A is, BufferedImage img) { |
21 | is?.setImage(img); |
22 | ret is; |
23 | } |
24 | endif |
Began life as a copy of #1007468
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016672 |
Snippet name: | setImage |
Eternal ID of this version: | #1016672/6 |
Text MD5: | f76c7a67999142fee7760c54ea4a05b4 |
Transpilation MD5: | 7e3b67b432449816d40c7abb1944d8d0 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-10 19:15:38 |
Source code size: | 594 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 503 / 578 |
Version history: | 5 change(s) |
Referenced in: | [show references] |