Beispiel #1
0
 /**
  * Remove a child Widget from this container.
  *
  * @param index the index of the Widget to remove
  */
 public void remove(int index) {
   Widget w = child.get(index).widget;
   getComponent().remove(w.getComponent());
   child.remove(index);
   removeAsParent(w);
   invalidateSize();
 }
Beispiel #2
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();
 }