//
// KeyListener
//
public void keyPressed(KeyEvent ke) {
JScrollBar vbar = scrollpane.getVerticalScrollBar();
JScrollBar hbar = scrollpane.getHorizontalScrollBar();
switch (ke.getKeyCode()) {
case KeyEvent.VK_NUMPAD7:
hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD8:
case KeyEvent.VK_UP:
vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD9:
hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD1:
hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD2:
case KeyEvent.VK_DOWN:
vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD3:
hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
break;
case KeyEvent.VK_NUMPAD4:
case KeyEvent.VK_LEFT:
hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
break;
case KeyEvent.VK_NUMPAD6:
case KeyEvent.VK_RIGHT:
hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
break;
case KeyEvent.VK_NUMPAD5:
// center on the selected entity
if (selectedEntity != null) {
centerOnHex(selectedEntity.getPosition());