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

31
LINES

< > BotCompany Repo | #1007468 // setButtonImage

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

Libraryless. Click here for Pure Java version (7381L/43K).

1  
static JButton setButtonImage(Icon img, JButton btn) {
2  
  btn.setIcon(img);
3  
  ret btn;
4  
}
5  
6  
static JButton setButtonImage(Image img, JButton btn) {
7  
  btn.setIcon(imageIcon(img));
8  
  ret btn;
9  
}
10  
11  
static <A extends AbstractButton> A setButtonImage(Image img, A btn) {
12  
  btn.setIcon(imageIcon(img));
13  
  ret btn;
14  
}
15  
16  
static <A extends AbstractButton> A setButtonImage(A btn, Image img) {
17  
  ret setButtonImage(img, btn);
18  
}
19  
20  
static <A extends AbstractButton> A setButtonImage(A btn, S imageID) {
21  
  btn.setIcon(imageIcon(imageID));
22  
  ret btn;
23  
}
24  
25  
static JButton setButtonImage(JButton btn, Image img) {
26  
  ret setButtonImage(img, btn);
27  
}
28  
29  
static JButton setButtonImage(JButton btn, Icon img) {
30  
  ret setButtonImage(img, btn);
31  
}

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: #1007468
Snippet name: setButtonImage
Eternal ID of this version: #1007468/13
Text MD5: e0d6cd72453784bcb9b387e815b092ab
Transpilation MD5: c23951f2bd03183b756bdc15330e817a
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-15 22:31:54
Source code size: 741 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 627 / 737
Version history: 12 change(s)
Referenced in: [show references]