Hello,
Can someone please help me with a question,
I need to have a textField where the user enters a 4 digit number, it should also be a TextField.PASSWORD, how can i add a TextField.NUMERIC restriction?
thank you
Printable View
Hello,
Can someone please help me with a question,
I need to have a textField where the user enters a 4 digit number, it should also be a TextField.PASSWORD, how can i add a TextField.NUMERIC restriction?
thank you
Have you tried using a JFormattedTextField? Or if it must be a JPasswordField you could always add a TextFilter to the field's Document.
JFormatedTextField in j2me? clcd ?
Are you sure?
i tried to find someting.. but the only i found to do this is by implementing the ItemStateListener somehow.
I searched the api's but it wasn't realy clear if i could just "add a restruction" it it's constructor.
No, I'm sure Fubarable responded without noticing that this was in a Java ME section of the forum.Quote:
JFormatedTextField in j2me? clcd ?
It's a long time since I did any Java ME, but I think you can achieve your requirement by using TextField.NUMERIC | TextField.PASSWORD (or possibly TextField.NUMERIC + TextField.PASSWORD which, according to the documentation, should give the same result)
Unless they've fixed it (not likely, it was around for 3-4 years already when I stumbled across it) there's a bug in the implementation of setConstraints(...), so the only safe way to set the constraints is in the TextField's constructor.
db
Now it works :), good with both "+" and "|" thank you verry much.