2) Don't loop through the collection, get the next or previous result strnig, based on what button was clicked, and set it in the txtresult
1) No need of s,s1,s2,s3,s4, string and str variables, you can concatenate the result in the argument to v.addElement() itself.
2) There in no need to convert Vector into array, you can use the vector itself.
3) If you are using 1.5 or higher, go for generics, you can avoid the toString() call.
Thanks & Regards, Happy to help
Parimal Nanoti (SCJP 6)