RE: [OpenMap Users] receiving key events in a layer

From: Peter Wilkes <pwilkes_at_cowpie.acm.vt.edu>
Date: Mon, 16 May 2005 14:22:42 -0400 (EDT)

Darol,

        can i ask where you added this code? i still don't seem to be
picking up the events. i've tried this

MapPanel extends JPanel implements MouseListener, KeyListener
{
MapBean mapbean;
MapPanel()
{
...
mapbean.addKeyListener(this)
mapbean.addMouseListener(this)
...
}
...
public void keyPressed(KeyEvent e)
{
system.out.println("key pressed");
}

public void mouseEntered(MouseEvent e)
{
requestFocus();
system.out.println("focus requested");
}
}


with this i see the "focus requested" system outs however i don't seem to
see the "key pressed" system outs. if i change the code to have the
listeners goto the JPanel instead of the mapbean i don't seem to get
either system outs.

thanks for the help!

Pete


On Mon, 16 May 2005, Klawetter, DG Darol (6274) _at_ IS wrote:

> Hi Pete,
>
> To capture key strokes, you will not only have to add a key listener, but
> you will have to perform a "requestFocus()" in your map frame and/or
> mapBean. I performed the requestFocus upon a mouseEntered() event. I could
> not detect keystrokes until I did this.
>
> Darol
>
> -----Original Message-----
> From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]On
> Behalf Of Peter Wilkes
> Sent: Monday, May 16, 2005 9:35 AM
> To: openmap-users_at_bbn.com
> Subject: [OpenMap Users] receiving key events in a layer
>
>
> Hello all!
>
> My client asked for additional Map functionality by cycling through the
> displayed map objects by pressing keys on the keyboard. they feel if a lot
> of items are displayed on the map this might make it easier to select map
> objects.
>
> i tried implementing KeyListener on my Layer to pick up key events however
> that did not seem to work. i also tried implementing KeyListener on the
> JPanel that contains the map bean however that did not seem to work.
>
> does anyone have any suggestions on how i could fulfill this
> functionality?
>
> thank you. any help is greatly appreciated.
>
> Pete
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe openmap-users"]
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon May 16 2005 - 14:23:42 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT