Results 1 to 2 of 2
  1. #1
    tomtraxler is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

Similar Threads

  1. Sockets - 1 sender, but multiple listening
    By Ambergahill in forum New To Java
    Replies: 2
    Last Post: 11-11-2010, 03:27 AM
  2. Java keypress detection help
    By pghazanfari in forum Advanced Java
    Replies: 1
    Last Post: 05-29-2010, 08:30 PM
  3. help with identifying components of a gui
    By jaytee in forum New To Java
    Replies: 1
    Last Post: 03-08-2010, 02:28 AM
  4. KeyPress for my Button
    By bigj in forum New To Java
    Replies: 3
    Last Post: 01-26-2010, 04:27 PM
  5. Replies: 1
    Last Post: 06-26-2009, 03:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •