# Java Consume won't Consume?



## Davidov541 (Apr 20, 2004)

OK, so I have a class that inherits from KeyListener, and one of the things i want to do is if someone presses enter or any other key at a certain time, it won't happen in the text box. My program works for every key except the enter/tab key. It will get to the line (i have checked using system.out.println() but it keeps letting you press enter/tab. Does keylistener not consume returns/tabs but it consumes everything else? What can i do to circumvent this problem? Thanks!


----------



## Chicon (Jul 29, 2004)

Hi Davidov541,

The TAB and Enter keys don't work for a JTextField but they work for a JTextPane.


----------

