Monday, October 29, 2012

Consume Keyboard Events using DocumentFilter

use DocumentFilter to consume keyboard events in java JTextComponents, the structure is as follows:
  1. declare a class that extends DocumentFilter class
  2. from yout text Component instance get the AbstractDocument object
  3. set the document filter of that Abstract Document to be the instance of your class that extends the DocumentFilter
  4. using the and override the methods of the Document filter class

Hope this was sutisfuctory to your problem