Efficient way to capture all keyboard input

  • Follow


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

0
Reply timasmith (248) 2/12/2007 3:01:00 AM

"Timasmith" <timasmith@hotmail.com> wrote in message 
news:1171249260.891333.276690@j27g2000cwj.googlegroups.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


0
Reply Fred 2/12/2007 11:14:46 PM


On Feb 12, 6:14 pm, "Fred Kleinschmidt"
<fred.l.kleinmschm...@boeing.com> wrote:
> "Timasmith" <timasm...@hotmail.com> wrote in message
>
> news:1171249260.891333.276690@j27g2000cwj.googlegroups.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.


0
Reply Timasmith 2/13/2007 12:31:30 AM

> 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?


0
Reply Larry 2/13/2007 5:47:06 PM

On 2=D4=C212=C8=D5, =C9=CF=CE=E711=CA=B101=B7=D6, "Timasmith" <timasm...@ho=
tmail.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=3D KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); //
define a key stroke for "enter"
Action keyAction =3D new AbstractAction() {
   public void actionPerformed(Event e){
      System.out.println("Enter is pressed!");
   }
};
JPanel c=3D(JPanel) getContentPane(); // c is the top JComponent on your
main frame.
c=2EgetInputMap(JComponent.WHEN_FOCUSED_WINDOW).put(enter,"enter");
c=2EgetActionMap().put("enter",keyAction);

put above code into your Frame initialized mothed.

0
Reply liang 2/14/2007 3:02:50 PM

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.

0
Reply Timasmith 2/15/2007 4:17:09 AM

5 Replies
433 Views

(page loaded in 7.458 seconds)

Similiar Articles:













7/23/2012 11:50:09 AM


Reply: