Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1016672 // setImage

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7203L/42K).

static JLabel setImage(final BufferedImage img, final JLabel lbl) {
  if (lbl != null) swing { lbl.setIcon(imageIcon(img)); }
  ret lbl;
}

static JLabel setImage(JLabel lbl, BufferedImage img) {
  ret setImage(img, lbl);
}

static JLabel setImage(final S imageID, final JLabel lbl) {
  if (lbl != null) swing { lbl.setIcon(imageIcon(imageID)); }
  ret lbl;
}

static JLabel setImage(JLabel lbl, S imageID) {
  ret setImage(imageID, lbl);
}

ifclass ImageSurface
static <A extends ImageSurface> A setImage(A is, BufferedImage img) {
  is?.setImage(img);
  ret is;
}
endif

Author comment

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: 502 / 577
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)