0

How to achieve eventhandling in jtextfield in swing. eg on filling the text field with maximum allowed string length, call a method for eg display a message in label (You have entered maximum allowed length).

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

-2

You can attach a DocumentFilter to the underlying model (Document) A working example can be found here https://stackoverflow.com/a/10586740/522770

Community
  • 1
  • 1
maneesh
  • 1,692
  • 1
  • 14
  • 18
  • Unless your link to other answers to support your own answer, don't. Either leave the link as a comment or vote to close the question as a duplicate. It looks like all you're doing is trying to gain reputation from other peoples work/answers – MadProgrammer Apr 16 '17 at 11:12
  • "It looks like all you're doing is trying to gain reputation from other peoples work/answers " Did you bother to look at my other answers to see if this is true or is it just your armchair opinion? – maneesh Apr 17 '17 at 05:27
  • Yes, it's not your answer, you've added nothing to it, that isn't already mentioned in the answer, making it a simple duplicate – MadProgrammer Apr 17 '17 at 05:30
  • I can understand the "mark duplicate" part. Frankly speaking I am not sure how it's done. I am not that well versed with SO. There was no need for "trying to gain reputation from other peoples work" It is offensive and a personal level comment. – maneesh Apr 17 '17 at 05:41
  • I was trying to provide you with the reason "why", it's not meant to be offensive, and I did say "It looks like", I wasn't implying that's what you were doing. Had you used the previous answer as part of an extended answer, ie "Based on this answer you code do this" and demonstrate how it could applied, I'd have no issue, simply linking to another answer just looks ... bad – MadProgrammer Apr 17 '17 at 05:45