I want to restrict user from entering Special characters in SWT text field. I tried the below code, but it is not working....
txt_Appname.addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent e) {
char chars = e.character;
if (!Character.isLetterOrDigit(chars)) {
e.doit = false;
return;
}
}
});
can any one give me the working code for restricting special characters in SWT textfield ?