?
Solved

JTextField - Masking Input

Posted on 2001-06-27
5
Medium Priority
?
460 Views
Last Modified: 2008-03-17
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
Comment
Question by:thenopsis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 6231835
Dear thenopsis,

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

Hope u will get the answer


bye
0
 
LVL 10

Expert Comment

by:Nushi
ID: 6232968
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
 
LVL 5

Accepted Solution

by:
Calron earned 75 total points
ID: 6234044
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
 

Author Comment

by:thenopsis
ID: 6250233
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
 

Author Comment

by:thenopsis
ID: 6250234
Thanks, the stuff at this site was helpfule in doing what I wanted to do. Thanks again
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question