GAMBIA-L Archives

The Gambia and Related Issues Mailing List

GAMBIA-L@LISTSERV.ICORS.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Alieu Bah <[log in to unmask]>
Reply To:
The Gambia and related-issues mailing list <[log in to unmask]>
Date:
Thu, 30 Nov 2000 12:27:24 -0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (74 lines)
Hi there:

I believe I've discovered a bug with the JComponent class.I created a bean
that extends JComponent making use of the method registerKeyboardAction
(ActionListener anAction, String aCommand,
KeyStroke aKeyStroke, int aCondition).When I made use of my bean in an
application the keystokes that I registered using this method  certainly
worked fine, but then today I decided to use my bean in an applet.
Suddenly the keystokes that I registered aren't working. I can't figure out
why that is...or how to work around this problem?

Here's the function in my bean that gets called when the bean first
becomes initialized:



private void registerKeyStrokes()
         {
             if(activeCellEnabled)
             {
                registerKeyboardAction(new NewAction("MoveLeft"),
       KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), WHEN_FOCUSED);
                registerKeyboardAction(new NewAction("MoveRight"),
       KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveUp"),
       KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveDown"),
       KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadWest"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadEast"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadNorth"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD8, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadSouth"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD2, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadNorthWest"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD7, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadNorthEast"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD9, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadSouthWest"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD1, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("MoveNumPadSouthEast"),
       KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD3, 0), WHEN_FOCUSED );
                registerKeyboardAction(new NewAction("CtrlEnter"),
       KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Event.CTRL_MASK),
WHEN_FOCUSED
       );
                registerKeyboardAction(new NewAction("Control"),
       KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, Event.CTRL_MASK),
       WHEN_FOCUSED );
             }
         }



Like I said, I don't see anything wrong with it. It certainly works when
used in an application.  If you have had similar problem and know of a
workaround, please let me know.

Regards,
Alieu

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

----------------------------------------------------------------------------

To unsubscribe/subscribe or view archives of postings, go to the Gambia-L
Web interface at: http://maelstrom.stjohns.edu/archives/gambia-l.html
You may also send subscription requests to [log in to unmask]
if you have problems accessing the web interface and remember to write your full name and e-mail address.
----------------------------------------------------------------------------

ATOM RSS1 RSS2