开发者

How do I align a GWT application to the center?

I have an html5 canvas element within a flextable, that flextable is added to the rootpanel. I would like to align the application so it is displayed in the center of the page both vertically and horizontally. Currently it is displayed in the upper left hand corner. I searched google and tried messing with the canvas element style but that didn't appear to change anything. I'm not tied to using the flex table if something else makes more sense. I do use it to display the frames per second in another cell.

Document document = Document.get();
Canvas canvasElement = (Canvas) document.getElementById("canvas");
final MyFocusWidget webGLCanvas = new MyFocusWidget((Element) canvasElement);
flexT开发者_JAVA百科.setWidget(0, 0, webGLCanvas);
RootPanel.get("flexTable").add(flexT);


It looks like you have a div in your html-file called flexTable. I would style that div like this:

<div id="flexTable" style="top: 50%; left: 50%;"></div>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜