Java

Java - Key Event Concept

Java - Key Event Concept
/* keyboard event */ 

import java.awt.*; 
import java.applet.*; 
import java.awt.event.*; 

public class keybo extends Applet implements KeyListener 
{ 
Label l; 
TextField t; 

public void init() 
{ 
l = new Label("enter the charecter : "); 
add(l); 

t = new TextField(10); 
t.addKeyListener(this); 
add(t); 
} 

public void keyPressed(KeyEvent e) 
{ } 

public void keyReleased(KeyEvent e) 
{ } 

public void keyTyped(KeyEvent e) 
{ 
showStatus("the given charecter is : "+e.getKeyChar()); 
} 
} 


/* <body> 
<applet code = "keybo.class" width = 200 height = 200> 
</applet> 
</body> */
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.