0
我試圖創建自己的複合鍵,使用DIV作爲外父:將元素投射到FlowPanel?
public class CompoundButton extends ButtonBase {
public CompoundButton() {
super(DOM.createDiv());
}
}
ButtonBase的構造希望有一個元素實例,雖然,所以我使用的DOM.createDiv()呼叫。但我怎麼能在這一點?:
public CompoundButton() {
super(DOM.createDiv()); <-- we're just a div.
// ButtonBase has no "add()" method - but this class is really
// just a div instance, so shouldn't I be able to convert it to
// a FlowPanel for example to be able to add elements to it here?
this.add(new FlowPanel()); <-- not possible, "add()" not available here.
感謝
您只需使用一個標籤或FlowPanel和風格它看起來像一個按鈕。你需要從ButtonBase中獲得什麼? –
我需要爲它添加移動設備的事件處理程序。正常的addClickHandler實現在移動瀏覽器上無法正常工作,因爲內置了300毫秒的點擊延遲。 – user291701
哪些處理程序? Label幾乎與ButtonBase具有相同的處理程序,包括HasAllTouchHandlers和HasAllGestureHandlers。 –