2014-10-07 225 views
0

我尝试TabPanel和PopUp小部件,但都显示在浏览器中没有样式...我从互联网上下载的其他示例没有问题。这是怎么回事?GWT小部件没有显示样式

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

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

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

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

例如,我是取消注释镀铬为例:

<!-- 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'/> 

过去,我会说:“检查元素”在Chrome或使用内置的浏览器开发者工具查看正在加载或应用什么CSS文件。

+0

谢谢!它解决了我的问题! – 2014-10-07 17:59:52

相关问题