我正在尝试创建自己的复合按钮,使用 div 作为外部父级:
public class CompoundButton extends ButtonBase {
public CompoundButton() {
super(DOM.createDiv());
}
}
不过,ButtonBase 的构造函数需要一个 Element 实例,所以我使用的是 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.
谢谢