Hello,
when I create my own jFrame/jDialog, and I use JMapPane like this:

public class MapPositionChooser extends JDialog implements KeyListener {
   private JMapPane mapPane;
   
   public MapPositionChooser(File mapFile) {
      //...
      this.mapPane = new JMapPane(new MapContent());
      this.getContentPane().add(this.mapPane);
      this.addKeyListener(this);
   }

   @Override
   public void keyPressed(KeyEvent e) {
        for (Field f : KeyEvent.class.getDeclaredFields()) {
                f.setAccessible(true);
                try {
                        if (f.get(null).equals(e.getKeyCode())) {
                                log.debug("Unknown action for key pressed. 
code=" + e.getKeyCode() + ", that is: " + f.getName());
                                break;
                        }
                } catch (Exception e1) {
                }
        }
        log.debug("Unknown action for key pressed. code=" + e.getKeyCode());
   }
}

Than I do not receive any keypress event. In 2.7.2 geotools version it does 
worked.

Workaround is to add keylistener directly to map pane:

      this.mapPane.addKeyListener(this);

PS: Map pane is now handling panning map with left,right,up and down keys. I 
see MapPaneKeyHandler class is used in setKeyHandler on map pane. Is there any 
other types of map pane key handlers? Specifically I am searching for some num 
pad key handler (I have made one, so if there is need for this type of key 
handler, I could contribute it).

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to