Im trying to get my KeyEvent working. Sadly the keyTyped(KeyEvent e)
isnt responding at all. :)
I implemented the KeyEvnet to my class.
I assigned the listener like following:
JTextfield searchBar = new JTextField();
searchBar.addKeyListener( this );
My key event looks like this:
@Override
public void keyTyped(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
System.out.println("pressed");
try {
int browser = getSelectBrowser().getSelectedIndex();
logic.search( searchBar.getText(), searchInfo, browser, isURL );
} catch (InterruptedException ie) {
System.out.println( "Pressed fail" );
}
this.repaint();
}
}
I also tried the Listener in a second test Gui and were it also does not work.
:-)