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

23
LINES

< > BotCompany Repo | #1010280 // Test JButton with text and image [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (3070L/22K).

1  
!7
2  
3  
p-awt {
4  
  new L<JButton> buttons;
5  
  addAndReturn(buttons, makeButton("Default"));
6  
  addAndReturn(buttons, makeButton("HCenter")).setHorizontalTextPosition(SwingConstants.CENTER);
7  
  addAndReturn(buttons, makeButton("VBottom")).setVerticalTextPosition(SwingConstants.BOTTOM);
8  
  
9  
  JButton btn = addAndReturn(buttons, makeButton("HCenter/VBottom"));
10  
  btn.setVerticalTextPosition(SwingConstants.BOTTOM);
11  
  btn.setHorizontalTextPosition(SwingConstants.CENTER);
12  
  
13  
  btn = addAndReturn(buttons, makeButton("HCenter/VBottom, gap 20"));
14  
  btn.setVerticalTextPosition(SwingConstants.BOTTOM);
15  
  btn.setHorizontalTextPosition(SwingConstants.CENTER);
16  
  btn.setIconTextGap(20);
17  
  
18  
  showFrame(jscroll(jfullcenter(hstackWithSpacing(buttons))));
19  
}
20  
21  
static JButton makeButton(S text) {
22  
  ret jImageAndTextButton_defaultPlacement(#1010239, text, r { infoBox("Hello!") });
23  
}

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: #1010280
Snippet name: Test JButton with text and image [OK]
Eternal ID of this version: #1010280/10
Text MD5: 976ee4bfcdd88506c238bb73a344e6d1
Transpilation MD5: b1b13cd99f9ada1aadf034f01c1fa1e1
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-10 17:05:31
Source code size: 883 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 686 / 1469
Version history: 9 change(s)
Referenced in: [show references]