You can't set the size of the cell that 'b' is in before you add 'b' to a cell.
> v.setCellWidth(b, "100px"); > v.add(b); > Ian http://examples.roughian.com 2008/12/8 wurenhai <[EMAIL PROTECTED]> > > Let's read the following code: > ======CellPanel.java=== > /** > * Sets the height of the cell associated with the given widget, > related to > * the panel as a whole. > * > * @param w the widget whose cell height is to be set > * @param height the cell's height, in CSS units > */ > public void setCellHeight(Widget w, String height) { > Element td = DOM.getParent(w.getElement()); > DOM.setElementProperty(td, "height", height); > } > > /** > * Sets the horizontal alignment of the given widget within its > cell. > * > * @param w the widget whose horizontal alignment is to be set > * @param align the widget's horizontal alignment, as defined in > * [EMAIL PROTECTED] HasHorizontalAlignment}. > */ > public void setCellHorizontalAlignment(Widget w, > HorizontalAlignmentConstant align) { > Element td = getWidgetTd(w); > if (td != null) { > setCellHorizontalAlignment(td, align); > } > } > > /** > * Sets the vertical alignment of the given widget within its cell. > * > * @param w the widget whose vertical alignment is to be set > * @param align the widget's vertical alignment, as defined in > * [EMAIL PROTECTED] HasVerticalAlignment}. > */ > public void setCellVerticalAlignment(Widget w, > VerticalAlignmentConstant align) { > Element td = getWidgetTd(w); > if (td != null) { > setCellVerticalAlignment(td, align); > } > } > > /** > * Sets the width of the cell associated with the given widget, > related to the > * panel as a whole. > * > * @param w the widget whose cell width is to be set > * @param width the cell's width, in CSS units > */ > public void setCellWidth(Widget w, String width) { > Element td = DOM.getParent(w.getElement()); > DOM.setElementProperty(td, "width", width); > } > > ==== > The method setCellSize is defferent from setCellAlign. > I want to say that, there is a bug use setCellSize: > VerticalPanel v = new VerticalPanel(); > Button b = new Button("Button"); > v.setCellWidth(b, "100px"); > v.add(b); > These codes are normal when i uesed in debug model, but there is a IE > error after i comlie it. The "td" is null! > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---