PDA

Click to See Complete Forum and Search --> : Trapping keypress in a JTextbox...


nemaroller
Jun 11th, 2002, 12:01 PM
I could use some guidance on how to trap the ENTER key in a JTextbox....

As of now, my customers have to manually click a submit button when done entering the data...

nemaroller
Jun 12th, 2002, 10:06 AM
thanks dilinger, I found some other code too on the Sun Forums...

basically a one-line statement...

rootPane.setDefaultButton(button1);

Dillinger4
Jun 12th, 2002, 10:49 AM
See what lack of sleep will get you. :D

rjlohan
Jun 14th, 2002, 01:33 AM
Originally posted by nemaroller
thanks dilinger, I found some other code too on the Sun Forums...

basically a one-line statement...

rootPane.setDefaultButton(button1);

Well, technically, that's not catching the keypress event, but if it's what you want, there you go. :)

Dillinger4
Jun 14th, 2002, 02:09 AM
Originally posted by rjlohan
Well, technically, that's not catching the keypress event

True. ;)