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

23
LINES

< > BotCompany Repo | #1007747 // Test replacing AWT component

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

Uses 3874K of libraries. Click here for Pure Java version (5487L/37K/129K).

1  
!7
2  
3  
p-substance {
4  
  Component c = consoleInputField();
5  
  Container parent = c.getParent();
6  
  assertNotNull("woot", parent);
7  
  Component[] l = parent.getComponents();
8  
  LayoutManager layout = parent.getLayout();
9  
  int idx = indexOf(l, c);
10  
  if (idx < 0) fail("component not found in parent");
11  
  print("idx: " + idx);
12  
  print("Parent: " + parent);
13  
  O constraints = callOpt(layout, "getConstraints", c);
14  
  print("Constraints: " + constraints);
15  
  
16  
  // remove
17  
  parent.remove(c);
18  
19  
  // add new component  
20  
  JPanel p = centerAndEast(c, jbutton("Yo"));
21  
  parent.add(p, constraints, idx);
22  
  validateFrame(parent);
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: #1007747
Snippet name: Test replacing AWT component
Eternal ID of this version: #1007747/7
Text MD5: a5c023e545e2d2421590350e7be73bdb
Transpilation MD5: 4d952d5b8930618e82a0be24861e31a9
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-03 14:26:41
Source code size: 632 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 598
Version history: 6 change(s)
Referenced in: [show references]