If you know the pixel dimensions of a "Grid" in advance, you'd probably want to set the preferred and minimum sizes for Grid inside your Grid constructor.
Carey, you might want to choose a different layout manager for that JPanel container, if you want to control the gap between the two grids. It looks to me like FlowLayout is the default manager for JPanel, but using a FlowLayout with specified gap sizes might answer wesley's question, I think.
And that holds for the panels that contain all those lines too. You can get the same layout by using a GridLayout of sufficient rows and columns, with horizontal and vertical spacing of 1 (or whatever thickness), on a panel with black background. Fill it with opaque JLabels with backgroundcolor as suited. No need for size calculations or nasty paintComponent methods.
There are three kinds of actuaries: those who can count, and those who can't.