Hi,
i want to write a custom widget that extends HBoxLayoutContainer and consists of a label, a spinner and a button. The problem is, when i add that custom widget to an instance of HorizontalLayoutContainer, my widget becomes not visible. I guess this is due to the fact that the pixel-size of my widget after constructing is 0. Is it possible to force calculating and set the pixel in constructor?
Here the code of my custom widget:
Code:
public class Custom extends HBoxLayoutContainer {
public Custom() {
setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
Label label = new Label("Label");
SpinnerField<Integer> spinner = new SpinnerField<Integer>(new IntegerPropertyEditor());
TextButton b = new TextButton("Button");
add(label);
add(spinner);
add(b);
}
}
And here how i use it:
Code:
public class Test implements EntryPoint {
@Override
public void onModuleLoad() {
Custom c = new Custom();
HorizontalLayoutContainer container = new HorizontalLayoutContainer();
container.add(c);
RootPanel.get().add(c);
}
}