I'm having some trouble here that's really, really starting to frustrate me. I would be very grateful if anyone can help me understand what I am doing wrong.
This is supposed to be a connect4 game using all the pieces as objects. Somewhere along the line I screwed up.
IF anyone can help I would be extremely grateful!
A NullPointerException or NPE means that you're trying to de-reference a null, and often the cause can be found by carefully inspecting the offending object and trying to search for where it isn't being initialized. You already know the source, the PlayField array, and that the exception is occurring when calling GetPiece() on an item of this array. So the items of this array must be null, but how can this be when you initialize the array in the Board constructor?:
Well if you look a few lines up in the constructor you see this:
Do you see what you're doing? You're declaring a new Piece array called by the same name as the class field, PlayField, and so when you initialize the object referenced by this variable, you are only initializing and working with a variable local to the constructor not the one declared in the class, and this is your problem.
Solution, do not redeclare this variable in the constructor but rather use the variable declared in the class.
Also, please read up on UseCodeTags so that your code posts are readable (I have taken the liberty of editing your post and adding tags this time), and also read up on Java naming conventions since if you obey these, others, including your teachers and us, will be able to more readily understand your code.