Search code examples
lwuit

how to combine in LWUIT?


I have used this code for combine textFiled.PASSWORD with TextField.NUMERIC

txtpwd.setConstraint(TextField.PASSWORD | TextField.NUMERIC);

When I run in Emulator i can type string .but i just typed NUMERIC .

I go to this link and find to combine constraints !!!

How to combine constraints


Solution

  • First of all. The link that you have put is a lcdui API, be carefull about it.

    This is the TextField API that you need

    http://lwuit.java.net/javadocs/com/sun/lwuit/TextField.html

    Ok, seeing this http://lwuit.java.net/javadocs/com/sun/lwuit/TextArea.html#setConstraint(int)

    I think that you must use this line:

    textField.setConstraint(TextField.NUMERIC | TextField.PASSWORD);
    

    just the opposite.