GWT小部件显示没有风格

时间:2014-10-07 16:09:09

标签: gwt

我尝试TabPanel和PopUp小部件,但两者都在浏览器中显示,没有样式......我从互联网上下载的其他例子都很好。发生了什么事?

这是我看到的一个例子......我错过了什么? 感谢

enter image description here

那是我的代码:

.....
        Button search = Button.wrap(DOM.getElementById("search"));
        search.setVisible(true);

        search.addClickHandler(new ClickHandler(){
            public void onClick(ClickEvent event) {
                new MyPopup().show();
            }           
        });

    }

      private static class MyPopup extends PopupPanel {

            public MyPopup() {
              // PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
              // If this is set, the panel closes itself automatically when the user
              // clicks outside of it.
              super(true);

              // PopupPanel is a SimplePanel, so you have to set it's widget property to
              // whatever you want its contents to be.
              setWidget(new Label("Click outside of this popup to close it"));
            }
          }

1 个答案:

答案 0 :(得分:1)

您的.gwt.xml文件中的主题是什么?我认为你的默认GWT样式表没有被选中。

http://www.gwtproject.org/doc/latest/tutorial/style.html

例如,我的未注释Chrome浏览器就是一个例子:

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <!--<inherits name='com.google.gwt.user.theme.standard.Standard'/>-->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>

过去我会说&#34;检查元素&#34;在chrome上或使用内置的浏览器开发人员工具来查看正在加载或应用的CSS文件。