[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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