Advertisement Jump to content


This topic is now archived and is closed to further replies.


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

This topic is 6442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post

Link to post
Share on other sites
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 !! }

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!