views:

49

answers:

1

I want to create a text field that will be for dates and will have dd.mm.YYYY format. Now what I want the user to type only the numbers, not the dots to. So the field would be like:

_ _. _ _ . _ _ _ _

So when the user wants to type the date: 15.05.2010 for example, he will only type the numbers in the sequence 15052010.

Also I would like, when he presses on left or right arrow, the cursor to go from one field (not JTextField, but field in the JTextField) to the next. So lets say I have JTextField with this text in it: 15.05.2010 If the user is on the beginning and he presses the right arrow, the cursor should go to the .05 field.

I hope you understand me because right now I don't have any idea how to make this, or at least how to look for it on google.

+1  A: 

here you go JFormattedTextField

Xorty