PDA

View Full Version : Special Chars gets entered with alt(option) button.




vikasu
Mar 6, 2008, 12:34 AM
Dear All,

In a Java Text Field, why special characters gets entered when typing characters with alt(option) key pressed?
Is this MAC OS X' property or is there any way to stop this?

Plz reply ASAP.

Regards,
Vicky



Sayer
Mar 6, 2008, 12:50 AM
Uhm, because Option/Alt is a modifier key, and as such it modifies input on the keyboard. This expands the range of characters you can enter from what is printed on the key caps.

See: ˚≠∫

MrStevieP
Mar 6, 2008, 04:01 AM
You can filter input on a JTextFeild. Take a look at this http://www.rgagnon.com/javadetails/java-0197.html or this http://www.codeguru.com/java/articles/443.shtml

I have done this before and it works very well for stopping people entering punctuation chars. It should block any modifyer items, although most confess I've never tried it.