asimpkins
22 Aug 2008, 5:35 PM
I'm working on a new layout, and I need a way to get a component's default size before it has been rendered. Is there a good way to do this?
As an example, the following code:
public class Test implements EntryPoint {
public void onModuleLoad() {
TextField textField = new TextField();
System.out.println(textField.getOffsetWidth() + ", " + textField.getOffsetHeight());
Window window = new Window();
window.add(textField);
window.show();
System.out.println(textField.getOffsetWidth() + ", " + textField.getOffsetHeight());
window.hide();
}
}...will output:
0, 0
122, 22I'm looking for a way to access that "122, 22" value without having to actually add it to a container and display it. Is this possible?
As an example, the following code:
public class Test implements EntryPoint {
public void onModuleLoad() {
TextField textField = new TextField();
System.out.println(textField.getOffsetWidth() + ", " + textField.getOffsetHeight());
Window window = new Window();
window.add(textField);
window.show();
System.out.println(textField.getOffsetWidth() + ", " + textField.getOffsetHeight());
window.hide();
}
}...will output:
0, 0
122, 22I'm looking for a way to access that "122, 22" value without having to actually add it to a container and display it. Is this possible?