Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Efficient way to capture all keyboard input

Reply
Thread Tools

Efficient way to capture all keyboard input

 
 
Timasmith
Guest
Posts: n/a
 
      02-12-2007
Hi,

I have a frame with several splitpanes or panels. In general those
are navigation orientated - tab, arrow up, arrow down, click etc.

Whenever a user starts typing letters I want to place focus into a
particular (default) field. Of course if you are already in a text
field I would ignore it.

What is the most efficient way to do this without bogging down every
keystroke with overhead?

thanks

Tim

 
Reply With Quote
 
 
 
 
Fred Kleinschmidt
Guest
Posts: n/a
 
      02-12-2007

"Timasmith" <> wrote in message
news: oups.com...
> Hi,
>
> I have a frame with several splitpanes or panels. In general those
> are navigation orientated - tab, arrow up, arrow down, click etc.
>
> Whenever a user starts typing letters I want to place focus into a
> particular (default) field. Of course if you are already in a text
> field I would ignore it.
>
> What is the most efficient way to do this without bogging down every
> keystroke with overhead?
>
> thanks
>
> Tim
>

I think you need to clarify (to yourself and to us) what you
really mean to accomplish. The user is navigating around for
a purpose - usually to get the focus to a particular field.

You are going to cause the user a lot of grief if she then starts typing,
only to have the text go into a different field than she has
just navigated to. So she clicks in the desired field and then
starts typing. But no! you said that when she starts typing letters,
the input goes to the default field, not the one she is trying
to type into! She tries again, and again to no avail. Now she is
really angry, and finally just discards the entire app and goes to
a different vendor.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project


 
Reply With Quote
 
 
 
 
Timasmith
Guest
Posts: n/a
 
      02-13-2007
On Feb 12, 6:14 pm, "Fred Kleinschmidt"
<fred.l.kleinmschm...@boeing.com> wrote:
> "Timasmith" <timasm...@hotmail.com> wrote in message
>
> news: oups.com...
>
>
>
> > Hi,

>
> > I have a frame with several splitpanes or panels. In general those
> > are navigation orientated - tab, arrow up, arrow down, click etc.

>
> > Whenever a user starts typing letters I want to place focus into a
> > particular (default) field. Of course if you are already in a text
> > field I would ignore it.

>
> > What is the most efficient way to do this without bogging down every
> > keystroke with overhead?

>
> > thanks

>
> > Tim

>
> I think you need to clarify (to yourself and to us) what you
> really mean to accomplish. The user is navigating around for
> a purpose - usually to get the focus to a particular field.
>
> You are going to cause the user a lot of grief if she then starts typing,
> only to have the text go into a different field than she has
> just navigated to. So she clicks in the desired field and then
> starts typing. But no! you said that when she starts typing letters,
> the input goes to the default field, not the one she is trying
> to type into! She tries again, and again to no avail. Now she is
> really angry, and finally just discards the entire app and goes to
> a different vendor.
> --
> Fred L. Kleinschmidt
> Boeing Associate Technical Fellow
> Technical Architect, Software Reuse Project- Hide quoted text -
>
> - Show quoted text -


If you anywhere on the (tab/frame) which is not a text field then
pressing a letter would take you do the default text field.

Most commonly in this application you would be in a table or a list,
when you start to type it takes you to the default text field.


 
Reply With Quote
 
Larry Barowski
Guest
Posts: n/a
 
      02-13-2007

> If you anywhere on the (tab/frame) which is not a text field then
> pressing a letter would take you do the default text field.
>
> Most commonly in this application you would be in a table or a list,
> when you start to type it takes you to the default text field.


You are aware that JList has keyboard navigation using
"letter" keys, right?


 
Reply With Quote
 
liang.spark@gmail.com
Guest
Posts: n/a
 
      02-14-2007
On 2月12日, 上午11时01分, "Timasmith" <timasm...@hotmail.com> wrote:
> Hi,
>
> I have a frame with several splitpanes or panels. In general those
> are navigation orientated - tab, arrow up, arrow down, click etc.
>
> Whenever a user starts typing letters I want to place focus into a
> particular (default) field. Of course if you are already in a text
> field I would ignore it.
>
> What is the most efficient way to do this without bogging down every
> keystroke with overhead?
>
> thanks
>
> Tim


try this:

KeyStroke enter= KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); //
define a key stroke for "enter"
Action keyAction = new AbstractAction() {
public void actionPerformed(Event e){
System.out.println("Enter is pressed!");
}
};
JPanel c=(JPanel) getContentPane(); // c is the top JComponent on your
main frame.
c.getInputMap(JComponent.WHEN_FOCUSED_WINDOW).put( enter,"enter");
c.getActionMap().put("enter",keyAction);

put above code into your Frame initialized mothed.

 
Reply With Quote
 
Timasmith
Guest
Posts: n/a
 
      02-15-2007
On Feb 13, 12:47 pm, "Larry Barowski" <MElarrybar-AT-
eng_DOT_auburnANOTHERDOTeduEND> wrote:
> > If you anywhere on the (tab/frame) which is not a text field then
> > pressing a letter would take you do the default text field.

>
> > Most commonly in this application you would be in a table or a list,
> > when you start to type it takes you to the default text field.

>
> You are aware that JList has keyboard navigation using
> "letter" keys, right?


Yes, but I never use a JList - I only ever use JTable as I always end
up adding columns to a list.

Keyboard navigation by letter is not useful if your list items, a
subset of the results, primarily all begin with the same letter.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Capture With Mouse , Mouse Position Capture Max Java 7 08-08-2009 11:51 PM
Best way to capture input. Aaron Fude Java 6 11-29-2008 12:54 AM
can I use scanf to get input (some times user enters input sometimes not, just hit keyboard)? santa19992000@yahoo.com C Programming 4 09-09-2005 03:38 AM
self.focus stopping all keyboard input to window Mark Javascript 10 11-19-2004 03:53 AM
capture substring in the most efficient Magix C Programming 15 07-09-2004 04:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57