i tried to make a application which takes the numeric value default. i have done coding like this
public void startApp(){
Display.init(this);
TextField amt=new TextField();
Form form=new Form(Test);
form.addComponent(amt);
amt.setConstraint(TextField.NUMERIC);
form.show();
}
When i setConstraint to numeric. it 开发者_运维百科only accepts numeric value but i need to press the hash key and chage the key entry style to numeric. so how can i make the text field which should only be able to take numeric input by default. thanks in adavance.
Use setInputModeOrder(...);
. See the following sample code,
TextField txtf = new TextField();
txtf.setConstraint(TextField.NUMERIC);
txtf.setInputModeOrder(new String[] {"123"});
form.addComponent(txtf);
精彩评论