Solved

JTextField - Masking Input

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why does the Android Studio logcat show this error when the user presses the button? 2 46
Weekend adv creator 3 36
oracle 11g 23 73
arguments to jar 5 26
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

813 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

19 Experts available now in Live!

Get 1:1 Help Now