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.

static JButton jimageButton(S imageID, O action) {
  JButton btn = jbutton("", action);
  btn.setIcon(imageIcon(imageID));
  ret btn;
}

// button without action
static JButton jimageButton(S imageID) {
  ret jimageButton(imageID, null);
}

static JButton jimageButton(Image img) {
  ret jimageButton(img, null, null);
}

static JButton jimageButton(S imageID, S toolTip, Runnable action) {
  ret jimageButton(imageIcon(imageID), toolTip, action);
}

static JButton jimageButton(Image img, S toolTip, Runnable action) {
  var btn = jbutton("", action);
  setButtonImage(btn, img);
  ret setToolTip(toolTip, btn);
}

static JButton jimageButton(ImageIcon img, S toolTip, Runnable action) {
  var btn = jbutton("", action);
  setButtonImage(btn, img);
  ret setToolTip(toolTip, btn);
}

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: 477 / 581
Version history: 8 change(s)
Referenced in: [show references]