Thanks very much for the solution. After the constructor has finished it's as supposed to be. Ewald
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); GWT.log("- X=[" + x + "] y=[" + y + "]", null); } public int getx() { return(getAbsoluteLeft() + getOffsetWidth()); } public int gety() { return(getAbsoluteTop() + getOffsetHeight()); } } public class GWT25 implements EntryPoint { int x, y; public void onModuleLoad() { MyTabPanel tp = new MyTabPanel(); RootPanel.get().setStyleName("ROOTPANEL"); RootPanel.get().add(tp); x = tp.getAbsoluteLeft() + tp.getOffsetWidth(); y = tp.getAbsoluteTop() + tp.getOffsetHeight(); GWT.log("- X=[" + x + "] y=[" + y + "]", null); x = tp.getTabBar().getAbsoluteLeft() + tp.getTabBar ().getOffsetWidth(); y = tp.getTabBar().getAbsoluteTop() + tp.getTabBar ().getOffsetHeight(); GWT.log("- X=[" + x + "] y=[" + y + "]", null); GWT.log("- X=[" + tp.getx() + "] y=[" + tp.gety() + "]", null); } } On May 13, 12:01 pm, Magius <antonio.diaz....@gmail.com> wrote: > 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 <ewald.pankr...@gmail.com> 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 Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---