Checking TextField input constraints

(A bit long-winded, but a simple question...)

I've created TextField using:

tf2 = new TextField("Enter whatever:", null, 15, TextField.PASSWORD | TextField.NON_PREDICTIVE);

Later on in my code, I want to check whether tf2 still has the PASSWORD contraint.

Because I also included the NON_PREDICTIVE constraint, the following detection code doesn't work:

if (tf2.getConstraints() == TextField.PASSWORD) {

//code a

}

else {

//code b

}

So what's the correct way to detect?

Thanks,

James

[571 byte] By [jhodgskia] at [2007-11-27 8:34:23]
# 1
if ((getConstraints() & PASSWORD) == PASSWORD) {//code a}else {//code b}
jhodgskia at 2007-7-12 20:30:38 > top of Java-index,Java Mobility Forums,Java ME Technologies...