Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-11-2007, 12:05 PM
Member
 
Join Date: Jun 2007
Posts: 8
gary is on a distinguished road
help with JTextfield
Can anyone help

I have a group of JTextFields and when the user inputs a certain number of characters I would like to program to focus on the next field.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-11-2007, 01:30 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Hmm, in the way you want it to be implemented, this is a little bit complex problem. Because you can't know when the user finished his job with a textfied!! You can just guess it!

How you can guess it? You can listen textfield for a specified time period which is acceptable by your users. For example once user starts typing, you can count number of milliseconds passed from the last character entered! When this passes a certain threshold, you can decide that the user finished his job with that textfield and transfer the focus to the other one. And you will need to implement this in a separate thread!

In my opinion, if your application is not targeting to a very specific data entry job, this is not the correct way to implement entering data. Because today or tomorrow, your users will not be satisfied with the threshold selected above. You can control focus with tab key (focus transferred when user press tab key) or you can think about a more innovative way of getting the data (e.g. via an input file).
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-11-2007, 01:47 PM
Member
 
Join Date: Jun 2007
Posts: 8
gary is on a distinguished road
my application is targeted to a specif type of data entry and each textfield will always have the same ammount of characters inputed.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-11-2007, 03:41 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Quote:
my application is targeted to a specif type of data entry and each textfield will always have the same ammount of characters inputed.
Then it is easier. Check the number of characters and activity of textfields with a thread and change focus when user enters required number of characters.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-11-2007, 03:58 PM
Member
 
Join Date: Jun 2007
Posts: 8
gary is on a distinguished road
thanks but im a little slow when it comes to java, do you have a good example or link I could look at. ta.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to focus to another JTextfield? birdofprey AWT / Swing 2 04-09-2008 03:08 PM
Using Columns With JTextField The Evil Genius AWT / Swing 1 03-17-2008 03:01 AM
Can't edit JTextField after modal dialog JavaNerd Java Applets 0 02-07-2008 11:11 PM
Clean the content of the JTextField elizabeth AWT / Swing 1 07-26-2007 10:38 PM
How to determine if the value of a JTextField is double nemo New To Java 1 05-20-2007 01:19 PM


All times are GMT +3. The time now is 11:42 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org