开发者

Getting panel width and height in GWT

I want to draw a gradient to a canvas and add it to an AbsolutePanel, thus i need width and height of absolutePanel to define gradient vector. But event if I add AbsolutePanel to Root开发者_StackOverflow社区LayoutPanel (via the north-widget of a DockPanel, which width set to 100%) and call a method setGradient() after, i still get 0 for width and height. How can i get the dimensions of the panel?


Use getOffsetWidth() and getOffsetHeight() methods. The doc is here:

Gets the object's offset width in pixels. This is the total width of the object,
including decorations such as border, margin, and padding. 

The methods are defined in UiObject, so common for all widgets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜