我有這個類我的輸入文本框:如何關注GWT中的元素?
class InputTextBox extends FlowPanel {
public InputTextBox(String labelText) {
super();
Label label = new Label(labelText);
TextBox input = new TextBox();
this.add(label);
this.add(input);
this.addStyleName("myBox");
}
}
如何將焦點設置在該文本框,所以當onmoduleload被稱爲光標出現在文本框中?添加一個成員函數似乎會引發很多錯誤。
public void setFocus(boolean b) {
this.setFocus(b);
}
另一個問題:我如何引用文本框的值? private InputTextBox newUser = new InputTextBox(「Username」); newUser.getText()不起作用? –