One problem I found, in this code:
JButton name = new JButton(imgName);
particularly the
JButton name
part. You are defining (or trying to define) the variable "name" as a JButton, but it is already define as a String in your parameter variable list:
public Card(int i, String name, String imgName, String location)
Also, (I'm not 100% sure, but) I think your constructor has to be declared as public.
I don't know if I understand you correctly, but I think you're trying to name a variable in your code based on another String, which I'm pretty sure you cannot do. For example, if I get the user's input (say it's "cake"), I don't think there's a way to name a variable in my code "cake" solely based on the user's (or coder's) String-based input.
Hopefully this helped...