19
A
回答
26
如果你只是想將圖像添加到一個正常的GWT按鈕,然後PushButton是要走的路:
PushButton pushButton = new PushButton(new Image("test.png"));
4
或者,你這個方法。
Button editRow = new Button("Edit Row");
editRow.setHTML(("<img border='0' src='rowEdit.Png' />");
我發現PushButton似乎有正確計算x,y點擊點的問題,正常按鈕沒有。
23
通過按鈕不具有相同的行爲,你有比創建自己的圖像標籤更漂亮的解決方案:
Image img = new Image("whatever.jpg");
Button button = new Button();
button.getElement().appendChild(img.getElement());
1
只需設置HTML img標籤內按鈕爲:
Button btn = new Button("<img src='image.png'/>");
2
只需在圖像中使用CSS和樣式。像這樣的東西應該使圖像出現在按鈕文字之前:
background-image: url("/yourimage.png");
background-repeat: no-repeat;
height: 20px;
width: 20px;
相關問題
- 1. 使用uibinder的Gwt圖像按鈕
- 2. GWT的按鈕
- 3. GWT中的粘滯按鈕
- 4. BlackBerry中的圖像按鈕
- 5. 按鈕中的圖像-j2me
- 6. 按鈕圖像
- 7. 圖像按鈕,圖像resoultion
- 8. 帶文本和圖像組合的GWT按鈕
- 9. GWT SimplePager:如何更改尋呼機的按鈕圖像?
- 10. iOS圖像按鈕按下按鈕
- 11. 居中按鈕或圖像
- 12. GWT:打印按鈕
- 13. GWT切換按鈕
- 14. GWT鏈接按鈕
- 15. gwt按鈕錯誤
- 16. UIToolBar按鈕圖像
- 17. 與按鈕圖像
- 18. iPhone圖像按鈕
- 19. Android圖像按鈕
- 20. 圖像和按鈕
- 21. Powershell按鈕圖像
- 22. 圖像按鈕Ajax.ActionLink
- 23. HTML - 圖像按鈕
- 24. Android圖像按鈕
- 25. 圖像按鈕2010
- 26. Java圖像按鈕
- 27. android圖像按鈕
- 28. WPF圖像按鈕
- 29. 從按鈕點擊我下載圖像從GWT?
- 30. 按鈕中的中心圖像
你試過了什麼代碼,結果是什麼? – CPerkins 2009-09-22 01:11:19
如果你想有圖像和文字,那麼我可能創建了你想要的。我在這個SO問題上寫了一篇文章:http://stackoverflow.com/questions/1853042/creating-custom-button-in-gwt/2449019#2449019 – Juri 2010-03-15 17:25:35
GWT官方樣本: http://gwt.googleusercontent.com/樣品/展示/ Showcase.html#!CwCustomButton – 2013-01-23 05:44:04