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

31
LINES

< > BotCompany Repo | #1015031 // Image buttons for AI concepts [Swing]

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

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6680L/44K).

!7

p-noconsole {
  final DynamicHStack stack = dynamicHStack();
  
  // Layout 1 (picture in the middle, text directly underneath it)
  stack.addComponent(jImageAndTextButton(#1101204, "A cat"));
  stack.addComponent(jImageAndTextButton(#1101216, "A rocket"));
  
  // Layout 2 (text at the top, icon below it, bold text)
  swing {
    JButton b1, b2;
    stack.addComponent(b1 = jImageAndTextButton(#1101204, "CAT"));
    stack.addComponent(b2 = jImageAndTextButton(#1101216, "ROCKET"));
    for (JButton b : ll(b1, b2)) {
      setFontSize(15, makeBold(b)).setVerticalTextPosition(JButton.TOP);
      b.setVerticalAlignment(JButton.TOP);
    }
  }
  
  // Layout 3 (bold text at the bottom, icon above it)
  swing {
    JButton b1, b2;
    stack.addComponent(b1 = jImageAndTextButton(#1101204, "A cat"));
    stack.addComponent(b2 = jImageAndTextButton(#1101216, "A rocket"));
    for (JButton b : ll(b1, b2))
      makeBold(b).setVerticalAlignment(JButton.BOTTOM);
  }
  
  centerFrameWithWidth(700, showFrame(jscroll(jfullcenter(stack))));
}

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: #1015031
Snippet name: Image buttons for AI concepts [Swing]
Eternal ID of this version: #1015031/11
Text MD5: 7947b1ece84665b6f87772cbb2965fab
Transpilation MD5: f49b0544a2b911556ad53f3103867700
Author: stefan
Category: javax / a.i. / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-07 13:08:43
Source code size: 1076 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 341 / 865
Version history: 10 change(s)
Referenced in: [show references]