2014-10-07 91 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