[java] limiting mouse and textfield stuff... read for info..

Started by
1 comment, last by HearYouMe 22 years, 10 months ago
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?
Advertisement
textfield :
not sure, try setColumns(int)

limits mouse:
dont think so.. since the mouse doesnt belong to the java system.

{ Stating the obvious never helped any situation !! }
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

This topic is closed to new replies.

Advertisement