I'm currently trying to write a simple Swing app that grabs strings from a few JTextFields when a JButton is pushed, parses the strings for doubles, does some computations and spits the answer out into another JTextField. The logic is trivial but I'm new to swing and am having problems accessing the contents of the JTextFields. Here's what I have so far:
The only way I know of to get the button action event is the anonymous class around the area of line 25 (I currently have this area doing the iteration and print just so that I could
test the button). If I try to get the information from the fields here and pass it to the method at line marked 43 I get this error:
"cannot refer to a non final variable inside an inner class defined in a different method."
Ok, that makes sense. However if I just try to call the doCalc method from line 25 I get a "variable cannot be resolved" error when I try to refer to any of my JTextFields from that method. It seems like my issue is that I don't know how to bring those field's pointers into my doCalc method's namespace but I'm not sure how to implement this. Hints please?
[ June 23, 2008: Message edited by: Tristan Rouse ]
[ June 23, 2008: Message edited by: Tristan Rouse ]