Solved

JTextField - Masking Input

Posted on 2001-06-27
5
453 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
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 25 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now