示例#1
0
 /**
  * Add a Widget to this container. The Widget will occupy a rectangular block of cells.
  *
  * @param widget the Widget to add
  * @param col the first column the Widget will occupy
  * @param row the first row the Widget will occupy
  * @param width the number of columns the Widget will occupy
  * @param height the number of rows the Widget will occupy
  * @param layout the LayoutInfo to use for this Widget. If null, the default LayoutInfo will be
  *     used.
  */
 public void add(Widget widget, int col, int row, int width, int height, LayoutInfo layout) {
   if (col < 0
       || col + width > colWeight.length
       || row < 0
       || row + height > rowWeight.length
       || width < 1
       || height < 1) throw new IllegalArgumentException();
   if (widget.getParent() != null) widget.getParent().remove(widget);
   child.add(new ChildInfo(widget, layout, col, row, width, height));
   getComponent().add(widget.getComponent());
   setAsParent(widget);
   invalidateSize();
 }
示例#2
0
 /** Get a Collection containing all child Widgets of this container. */
 public Collection<Widget> getChildren() {
   ArrayList<Widget> list = new ArrayList<Widget>(child.size());
   for (int i = 0; i < child.size(); i++) list.add(child.get(i).widget);
   return list;
 }