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).

!7

p-substance {
  Component c = consoleInputField();
  Container parent = c.getParent();
  assertNotNull("woot", parent);
  Component[] l = parent.getComponents();
  LayoutManager layout = parent.getLayout();
  int idx = indexOf(l, c);
  if (idx < 0) fail("component not found in parent");
  print("idx: " + idx);
  print("Parent: " + parent);
  O constraints = callOpt(layout, "getConstraints", c);
  print("Constraints: " + constraints);
  
  // remove
  parent.remove(c);

  // add new component  
  JPanel p = centerAndEast(c, jbutton("Yo"));
  parent.add(p, constraints, idx);
  validateFrame(parent);
}

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: 513 / 594
Version history: 6 change(s)
Referenced in: [show references]