?
Solved

JTextField

Posted on 2003-03-20
8
Medium Priority
?
1,134 Views
Last Modified: 2008-02-26
Is there a type of Text Entry Field that only allows the user to enter numeric data, such as dates?
0
Comment
Question by:rich420
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:glottis
ID: 8179135
if u use jdk1.4 then there is JFormatTextField
else you can search for such components, or if u are a genius you can make one :P
0
 

Author Comment

by:rich420
ID: 8179247
thanks for that, but I couldn't find a JFormatTextField, or am I using the wrong version.

Did you mean JFormattedTextField? If so, How do I use JFormattedTextField to accept dates only?

Could I have a small example or explanation
0
 
LVL 1

Expert Comment

by:umangjoshi
ID: 8179318
glottis is right.

for date u can use thre list box for dd, mm and yyyy and a script for validation
0
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.

 

Author Comment

by:rich420
ID: 8179391
I am not allowed to have any validation scripts, because invalid characters should not even be allowed to be typed into the text field.
0
 
LVL 1

Expert Comment

by:umangjoshi
ID: 8179872
u r right, but i haven't any more idea
0
 
LVL 2

Expert Comment

by:glottis
ID: 8183555
JFormattedTextField ftf = new JFormattedTextField();
ftf.setValue(new Date()); // for dates

ftf.setValue(new Integer(1)); // for numbers

if u study the JFormattedTextField u can add poissibly any type of format
0
 

Accepted Solution

by:
hamish5 earned 200 total points
ID: 8221493
JFormattedTextField field = new JFormattedTextField();
field.setValue(new Format(##-##-##));
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.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month9 days, 20 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