How do you write a working key listener in java that responds to an 'enter'?

Almost all controls' ActionListener triggers the actionPerformed upon the enter key press Answer Using an anonymous class implementation: Component c; // this is the component you want to add a listener to c. AddKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if(e.getKeyChar() == e. VK_ENTER) { // put the code you want to execute when Enter is pressed here System.out.

Println("ENTER PRESSED"); } } // unused abstract methods public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} }).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions