itemList.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_SPACE) || (e.getKeyCode() == KeyEvent.VK_ENTER)) {
String internalFrameName = (String) itemList.getSelectedValue();
JInternalFrame internalFrame = (JInternalFrame) internalFrameMap.get(internalFrameName);
menuSelectionManager.clearSelectedPath();
internalFrame.toFront();
} else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
if (previousMenu != null) {
menuSelectionManager.clearSelectedPath();
previousMenu.doClick();
}
} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
if (nextMenu != null) {
menuSelectionManager.clearSelectedPath();
nextMenu.doClick();
}
} else if (e.getKeyCode() == KeyEvent.VK_HOME) {
itemList.setSelectedIndex(0);
} else if (e.getKeyCode() == KeyEvent.VK_END) {
itemList.setSelectedIndex(itemList.getMaxSelectionIndex() -1);
}
}
});
itemList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
String internalFrameName = (String) itemList.getSelectedValue();
JInternalFrame internalFrame = (JInternalFrame) internalFrameMap.get(internalFrameName);
menuSelectionManager.clearSelectedPath();
internalFrame.toFront();
//internalFrame.requestFocus();
}
});
setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));