[java] limiting mouse and textfield stuff... read for info..
2 replies to this topic
Members - Reputation: 122
Posted 26 May 2001 - 06:06 AM
first thanks to everyone who posted in my other threads. anyway TextFields: is there a way to limit what people can type in them? like only numbers? or is there a way to set a max length allowed to be typed in? Mouse Stuff: Say that you move the mouse onto the applet... is there a way once its on there to limit like where the mouse can move? like only in a small box?
Posted 30 May 2001 - 04:33 PM
yes there is a way to control what they can put in a text field. I''ve never done it myself though, but I think I got the idea. It involves subclassing the component and intercepting messages. You''ll have to override some methods, I think they are the various process methods. (in newer versions, they have different names and parameters in the old versions) So you get the event and if it isn''t something you want them to type you just ignore it, otherwise you call super.methodInQuestion