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

30
LINES

< > BotCompany Repo | #1006831 // jimageButton

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

Transpiled version (8020L) is out of date.

1  
static JButton jimageButton(S imageID, O action) {
2  
  JButton btn = jbutton("", action);
3  
  btn.setIcon(imageIcon(imageID));
4  
  ret btn;
5  
}
6  
7  
// button without action
8  
static JButton jimageButton(S imageID) {
9  
  ret jimageButton(imageID, null);
10  
}
11  
12  
static JButton jimageButton(Image img) {
13  
  ret jimageButton(img, null, null);
14  
}
15  
16  
static JButton jimageButton(S imageID, S toolTip, Runnable action) {
17  
  ret jimageButton(imageIcon(imageID), toolTip, action);
18  
}
19  
20  
static JButton jimageButton(Image img, S toolTip, Runnable action) {
21  
  var btn = jbutton("", action);
22  
  setButtonImage(btn, img);
23  
  ret setToolTip(toolTip, btn);
24  
}
25  
26  
static JButton jimageButton(ImageIcon img, S toolTip, Runnable action) {
27  
  var btn = jbutton("", action);
28  
  setButtonImage(btn, img);
29  
  ret setToolTip(toolTip, btn);
30  
}

Author comment

Began life as a copy of #1003312

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006831
Snippet name: jimageButton
Eternal ID of this version: #1006831/9
Text MD5: eb2483911d35b03133e077a9bb56f49c
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-10 07:31:01
Source code size: 812 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 586 / 732
Version history: 8 change(s)
Referenced in: [show references]