aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes addActionListener problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "addActionListener problem..." Watch "addActionListener problem..." New topic
Author

addActionListener problem...

Rocky Summers
Ranch Hand

Joined: Nov 07, 2003
Posts: 66
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.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: addActionListener problem...