• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

JTextField - Masking Input

I have two JTextFields in my application that I want to have the input masked as standard US currency. For example:
 Lets say someone goes to a JTextField and enters in 1050 in a the field. The output will look more like $1050.00 in the field. I would like to prevent them from being able to enter in any non-numeric keys, except a decimal.
0
thenopsis
Asked:
thenopsis
1 Solution
 
mohan_sekarCommented:
Dear thenopsis,

       Please visit http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html

Hope u will get the answer


bye
0
 
NushiCommented:
mohan_sekar  welcome to the experts.
please do not answer question and just post comments.

comments still gets the points and are not blocking the question.

i saw you in some other questions blocking them from people to notice them.

Nushi.
0
 
CalronCommented:
Have a look at the following link:

http://www.enteract.com/~goose/java/

It has very nice examples of how to write such masks as you are trying to make. With some adjusting you can use the classes provided there to do what you want to do.
0
 
thenopsisAuthor Commented:
Thanks for the lead on where to go but I have already looked at that link before and its not exactly what I am looking for.
0
 
thenopsisAuthor Commented:
Thanks, the stuff at this site was helpfule in doing what I wanted to do. Thanks again
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now