I'm trying to implement Nine Men's Morris game. For drawing the little ovals representing the moves, I'm using the Element class. This is used as a matrix in MorrisElement class. But when I'm trying to draw one element, NullPointerException() is throwed. When I was implementing the MorrisElement class, I didn't use try-catch. After the first run - without result - I put message into the NullPointerException part, and this message is shown when the program is running.
I'm new in Java, and haven't already met with this kind of problem, and I have no idea what to do to resolve it, and to draw the little ovals as it has to be.

Ah, you are now learning the difference between an array of primitive, say an int array, and an array of objects, say an Element array. With the primitive array, all you have to do is declare the array and use it -- it's ready immediately for your use.

With an object array on the other hand, you have to declare the array first, and then you have to initialize the objects in the array before you can use them. Think of creating an object array as if you were creating a parking lot. You have to fill it with cars first before you can use a car.

Consider using nested for loops to go through your element 2D array and create new element objects as you iterate through the loops. Also, never "catch" null pointer exceptions, and consider using code tags (please see my signature). Much luck.