2

Is there a built-in method for stopping user input when a certain number of characters have been entered? I was looking for an alternative to VerifyListeners.

Basilevs
  • 22,440
  • 15
  • 57
  • 102
user2738698
  • 520
  • 7
  • 19

2 Answers2

3

Do you mean that you want the input to your text field to be limited to a certain number of characters (at the same time)? In that case, you can use Text.setTextLimit() (see this answer).

tjalling
  • 453
  • 5
  • 16
-1

Sure there is. Check this answers or perhaps this one that is not attaching an event handler (or at least, not directly) for key pressed.

Hope it helps!

Community
  • 1
  • 1
Victor
  • 3,841
  • 2
  • 37
  • 63
  • don't understand mate, please explain more. Thanks. If you know please collaborate. – Victor May 31 '14 at 06:30
  • @Basilevs, i will delete this, please remove your donwvote! (there was no need at all..) i guess SWT was SWING!! – Victor May 31 '14 at 06:31
  • If fact @Basilevs , besides downvoting why you don't try to help the original poster and do some contribution to the answer. Thanks. – Victor May 31 '14 at 15:07
  • Reputation changes from bounties and votes (both up and down) on deleted posts (including answers to a deleted question) are nullified. (Exception: Reputation earned for posts with a score of three or higher, and where the post has been visible on the site for at least 60 days, is retained). [How does deleting work](http://meta.stackexchange.com/questions/5221/how-does-deleting-work-what-can-cause-a-post-to-be-deleted-and-what-does-that) I'd like to know answer myself. – Basilevs Jun 01 '14 at 05:26
  • Okey, anyway i would like to leave this until someone really help the OP goals. Thanks. – Victor Jun 02 '14 at 13:32
  • The time has come to remove this answer then. OP got the right answer – XtremeBaumer Jun 05 '18 at 12:31