• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

addActionListener problem...

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
i'm having trouble with ActionListener...
i'm doing a registration form. this is my code for a bunch of textfields:

and after that, i have the submit button:

All i just wanted to know is how to determine if user has inputted something in the textfield.
The error in that chunk of code is:

Is there any way of not making the txtfield[] a final and getting around it?
Thank you for your time.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, two ways to deal with this. One would be to make the textfield array a member variable rather than a local variable -- then it doesn't need to be final. The code would hardly change at all -- just move the declaration up to class scope.
The other way is just to make the existing variable final, as the compiler suggests. Making the array reference final does not prevent you from modifying the contents -- it only prevents you from allocating a new array altogether, something you likely don't need to do. Try it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic