Identifying sender on keypress event
I am new to Java and NetBeans. I have written a method to validate the entry in several textfields to make sure that the key pressed is either ENTER, BACKSPACE, DELETE, or the numerals 1-6. I have gone to the Properties of each of those textfields in NetBeans to invoke or call that same method, but I want to make sure that the character typed is not actually entered in the textfield unless it is validated to be one of those keys I listed above. I either want to nullify the entry or reset it to "0" if some other key is pressed. My question is how to have the validation method either nullify the keypress so that nothing is entered or identify the textfield that has the focus and is invoking the event so that I can reset its textfield to "0". thanks.