posted 23 years ago
hi,
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(KeyEvent ke) {
Object source = ke.getSource();
System.out.println("Code of key pressed:"+ke.getKeyCode());
if(source == jTextField1 )
{
if(ke.getKeyCode() == 10)
{
System.out.println("Enter key pressed");
}
//like this by finding key codes corresponding to the key you
want to restrict and then by giving if conditions you can do this.
}
}
);
with regards,
Rajesh Adukkadukkath
Netkode Solutions Pvt. Ltd.<br />Bangalore - 8<br />India.