In not 100% sure but I remember that the size is 0 until the component
is rendered.
In this moment the browser calculates the layout of the page.

And the browser executes first the js code, then update the DOM and
finally it repaint the page.
In this case, the final width and height are not available in the
constructor.

You can try using a resize event. I think it's called when the browser
sets the initial values.


On May 13, 4:57 am, Ewald Pankratz <[email protected]> wrote:
> Hi all
> I wounder why x and y are zero. Is this a bug? Maybe I do not
> understand the meaning behind.
>
> thanks.
>
> public class MyTabPanel extends TabPanel {
>
>        int x, y;
>
>        public MyTabPanel() {
>
>                super();
>
>                setStyleName("TAB_PANEL");
>                setSize("100%", "100%");
>
>                add(new HTML("here is the first tab"), "TAB1");
>                add(new HTML("here is the second tab"), "TAB2");
>                add(new HTML("third tab"), "TAB3");
>
>                selectTab(0);
>
>                x = getAbsoluteLeft() + getOffsetWidth();
>                y = getAbsoluteTop() + getOffsetHeight();
>
>                GWT.log("-  X=[" + x + "] y=[" + y + "]", null);
>
>                x = getTabBar().getAbsoluteLeft() + getTabBar
> ().getOffsetWidth();
>                y = getTabBar().getAbsoluteTop() + getTabBar
> ().getOffsetHeight();
>
>                GWT.log("-  X=[" + x + "] y=[" + y + "]", 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to