English 中文(简体)
GWT - 对话框. center () 不正确工作
原标题:GWT - DialogBox.center() doesn t work correctly
  • 时间:2012-05-23 16:09:04
  •  标签:
  • java
  • gwt

我的页面上有一张有按钮的桌子。 有很多按钮, 我有一个滚动器可以滚动到桌子上。

Button "onClick" generates a dialog box with scrollpanel, content and a button to close this dialog box. I center it using DialogBox.center(). When I press, let s say the first button in a table, dialog box appears strictly in the center.... but when I scroll down the page and press button in the bottom of my table, my DialogBox still appears in the "old" center...almost above my view. It simply doesn t move down according to my scrollbar position. I tried to change setPopupPosition(), setPopupPositionAndShow() and so on, but it didn t help.

有什么想法吗?这是我对话框的代码:

public class MyDialogBox extends DialogBox {

    public MyDialogBox(final String caption, final String text) {
        setText("Caption: " + caption);

        VerticalPanel inner = new VerticalPanel();
        Label msg = new Label(text);

        Button ok = new Button("Close");
        ok.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                    MessageTextBox.this.hide();
                }
        });

        inner.add(msg);
        ScrollPanel scrollbar = new ScrollPanel(inner);
        scrollbar.setSize("640", "480");
        VerticalPanel outer = new VerticalPanel();
        outer.add(scrollbar);
        outer.add(ok);
        setWidget(outer);
    }
}

这就是我的按钮怎么称呼它:

VerticalPanel mainPanel ... //MainPanel with a lot different elements, it contains panel with buttons
VerticalPanel panel ... //Panel with buttons
panel.setViewButtonHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
        MyDialogBox dialogBox = new MyDialogBox("Caption", "Some text");
        dialogBox.center();
        dialogBox.show();
     }
});
mainPanel.add(panel);
最佳回答

提到问题的源头似乎很简单。 铬对中对话框不正确。 我检查了 FF, IE... 并且它按计划运作 。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签