So I just started coding a Java program I'm writing and it's telling me that my global variables need to be static. I don't understand why it's telling me this because I've developed Java programs before without having to make my global variables static. Could someone please help?

FYI, in Java, what makes a variable "global" is marking it static. Technically it is scoped to a class and not an "old school" global like in C/C++, but still, that's the only way. You cannot have non-static global variables, so I'm guessing you may not be using the correct term.
–
SingleShotFeb 5 '11 at 21:59

Note that such initialization code is better put in a constructor method.

Btw the variables you refer to are not global. Right now you have as many distinct frame and makeMap as many instances of PlannerMain you create. They would only be "global" (or its closest equivalent in Java) if you declared them public static - in this case all PlannerMain instances would share the same frame and makeMap, and the external world would see them as well.

There are no global variables in Java in the meaning of variables which would be valid in the whole program.

There are

class variables: These are most similar to what are called "global" variables in other languages. They are declared inside a class with the static keyword. There is only one variable for the whole class. (If the class would be loaded again with another classloader, this new class would have new variables, of course.)

They should be used prefixed with the class: MyClass.varName. Inside of the class you also can let the prefix away, and you also could use them prefixed with an object of that type (but this is discouraged).

instance (or object) variables: These are what you have in your example: anything declared inside a class (and outside of any method/constructor/block) without the static keyword is a instance variable. For each object of the containing class (which includes objects of any subclasses of this class) there is exactly one variable. (From the "state" view, one could say an object consists of all its instance variables + an identity.)

They are used prefixed by an object (of the right type): myObject.varName. Inside of non-static methods of this class you can use them unprefixed (this is then referring to the variables of the current object).

local variables: These are all variables declared inside of a method or a constructor (or block). They exist once for each invocation of this method, and cease to exist after the method finished. They can only be accessed from inside this method, not from methods called from there.

Special cases of these are method/constructor parameters and catch-block-parameters.

array elements: Every element of an array is a variable of the same type. They can be used everywhere where one has a reference to this array (often in one of the other types of variables).

So, in your case you have object variables, and want to use them from a class method (static method). A class method has no current object, thus you have to qualify your variables with an object to use them. Depending on what you want, it may be useful to write it this way:

if you are using some property in a static method then the property hsould be static. I am guesssing you are using these global variables within the main method thus java is throwing this error. If you want to still access a global variable then probably define a class that is initialised with these global variables and instantiate the same in your main function and u can use it.