Ingela
January 12th, 2001, 09:46 PM
Hi,
When I click the enter key on my keyboard I would like an URL (a string from an textfield called text) to appear. I know I may use the \n character to see what has happened, but it doesn't work.
I would be even more happy if someone helped me to do this but with the asciicode instead (I tried a little, but now its an comment as you can see), just for learning.
Itworks when I use a button to get the homepage, yes it is an browser I am making.
Thankful for help...
/Ingela
public class EnterListener extends KeyAdapter{
public void KeyTyped(KeyEvent eve) {
try{
char ent = eve.getKeyChar();
if (ent == '\n'){
//char c = '\u0015';
System.out.println(" Testing in EnterListener:);
//String urlen = text.getText();
//String urlen = text.getText();
}
setCursor(Cursor.getDefaultCursor());
//jep.setPage(urlen);
}catch (Exception e){System.out.println(e);}
}
}//end class EnterListener
When I click the enter key on my keyboard I would like an URL (a string from an textfield called text) to appear. I know I may use the \n character to see what has happened, but it doesn't work.
I would be even more happy if someone helped me to do this but with the asciicode instead (I tried a little, but now its an comment as you can see), just for learning.
Itworks when I use a button to get the homepage, yes it is an browser I am making.
Thankful for help...
/Ingela
public class EnterListener extends KeyAdapter{
public void KeyTyped(KeyEvent eve) {
try{
char ent = eve.getKeyChar();
if (ent == '\n'){
//char c = '\u0015';
System.out.println(" Testing in EnterListener:);
//String urlen = text.getText();
//String urlen = text.getText();
}
setCursor(Cursor.getDefaultCursor());
//jep.setPage(urlen);
}catch (Exception e){System.out.println(e);}
}
}//end class EnterListener