I have a function that display the buffered image. I want mouse listener and key listener to be implemented in JLabel which loads the image. Since JLabel cannot get focus i trie
I don't know from where you knew JLabel can get Focus.
Documentation here clearly explains it cannot get Keyboard Focus.
let's back to the KeyBindings
myLabel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
KeyStroke.getKeyStroke((KeyEvent.DEL), 0, false), "DELETE");
myLabel.getActionMap().put("DELETE", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
// any/some Action
}
});