• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use Tab & Shift-Tab to move between text input fields?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Geez...
I have 20 input fields and must leave the keyboard
and click with the mouse to move to the next field.

Annoying and, I think, prob unnecessary.
Simply cannot find example code anywhere...
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about a for loop, inside a class that takes your table input.. something like (maybe)
import java.io.*;
public class InputHelp{
public String getTheInput(String promptUser){
String userInput = null;
for (integer iv=0;iv<20;iv++){
// prompt user
try {
BufferedRead is new BufferedReader{
//get the line
//test the line for length
} // catch the exception
} // end for
return userInput;
}
}
//the prompt user would hold a System.out.print or prinln, looping for your
input
just a guess
JL
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the Swing / JFC / AWT forum...
 
Michael Custer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind...
Thanks for the help but I found
something much simpler...

Now, simply add the on-key-press event handler inside the tags as follows:
(Notice how I've added hyphens to the keyword on-key-press). This script
doesn't seem to like the real word... Remove the hyphens, lol.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, this is an HTML/Javascript question. But I can see how this might look like a Swing question. It would have helped if Michael had mentioned it was a web form and not a Desktop GUI form...Moving again.
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add tabindex=1 to all field, you have to move through, if you want to navigate in the same order they located on a page.
Otherwise do tabindex=index, where index is taborder.
TABINDEX property
Note, that negative tabindex works only in IE.
 
Michael Custer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you...
Now I can skip a few buttons I was wondering about...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic