check a grid

I'm making som kind of game, it looks like a crossword puzzel.
What is the best way to check every side of a square? I use swing to build up the grid.
It also depends on if you fill in a word from left to right or from top to bottom because you don't need to check the squares in the direction you are typing a word. For now I have conditions for every case, but that's about 500 lines, it doesn't work.
Instead of debugging it, there has to be an easier way. I think I need to look to John Conway's Game of Life.

Re: check a grid

I'm not totally sure what your question is, but I think the answer is going to depend entirely on what kinds of data structures you're using to store the grid. A 2D array seems to make sense, but you haven't indicated your approach, so it's hard to comment further.

If you want better help, I suggest creating an SSCCE that demonstrates exactly what you're doing in as few lines as possible.