KeyListener funcionality
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Juan_Valderrama
Posted On:   Thursday, August 15, 2002 01:42 PM

Hi!, I dont speak english very well, sorry. In my applet code implements the KeyListener and i add the next code: public void keyReleased(KeyEvent e) { System.out.println("Released !"); } public void keyPressed(KeyEvent e) { System.out.println("Pressed !"); } public void keyTyped(KeyEvent e) { System.out.println("Typed !"); } Now, i run the applet and press a key and still pressed since a moment, 3 or 4 seconds, then i release the key. In the screen i have : Pressed ! Typed ! Released ! Pressed ! Typed ! Released ! Pressed ! Typed   More>>

Hi!, I dont speak english very well, sorry.


In my applet code implements the KeyListener and i add the next code:

			
public void keyReleased(KeyEvent e) {
System.out.println("Released !");
}
public void keyPressed(KeyEvent e) {
System.out.println("Pressed !");
}
public void keyTyped(KeyEvent e) {
System.out.println("Typed !");
}


Now, i run the applet and press a key and still pressed since a moment, 3 or 4 seconds, then i release the key.
In the screen i have :

			
Pressed !
Typed !
Released !
Pressed !
Typed !
Released !
Pressed !
Typed !
Released !
Pressed !
Typed !
Released !


but i think the response would be :

			
Pressed !
Pressed !
Pressed !
Pressed !
Pressed !
Pressed !
Pressed !
Typed !
Released !



How i know how much time the key has been pressed ?


Is this result the normal funcionality ??


Thanks and sorry for my poor english!


I've RedHat 7.3 in my box.


Bye    <<Less

Re: KeyListener funcionality

Posted By:   leandro_adrian  
Posted On:   Thursday, August 15, 2002 03:46 PM

Juan: mi opinion es que este es el funcionamiento normal. Para poner un ejemplo fijate que cuando en un editor de texto dejas presionada una tecla es lo mismo que si presionas la tecla, la soltas, la volves a presionar...


Es decir "hablando en eventos" ocurre un evento keypressed,
luego un keytyped y por ultimo un keyreleased y se repite este ciclo hasta que sueltas la tecla


Espero que sirva


Saludos
About | Sitemap | Contact