Sorry. I knew that == compares memory locations, but I guess that == would be ok in this case.
However, the variable f isn't initialized so it's throwing the Null Pointer Exception on the first...
Type: Posts; User: javapenguin
Sorry. I knew that == compares memory locations, but I guess that == would be ok in this case.
However, the variable f isn't initialized so it's throwing the Null Pointer Exception on the first...
You never initialized the variable f. That's why it's throwing that exception.
Also, when comparing objects like JButtons or Strings, use .equals(Object obj) method instead of ==.