I am currently working on my first program that will use a graphical user interface. I am attempting to create a Minesweeper look-a-like, being as true to the original as possible. I haven't programmed any game logic yet, but I am nearly finished with setting up the layout of my components.
Although it will technically work in the state I have it, there are a few things bugging me that I cannot seem to figure out.
First, I will post a few of the important code samples I will be discussing:
Now, my questions.
1. I have read through almost all of the swing tutorial, including the section on how to use the 'GroupLayout' layout. I am using this to set up the stat panel, with the counter/reset/timer button/labels. I want the two labels to be at each end, and the reset button to be in the middle. (I realize they aren't animated yet, I'll do that later). I thought that by grouping each one in a parallel group, and using the LEADING, CENTER, TRAILING constants, this would do that for me. However, as you can see, they like to group up in the middle:
Can anyone tell me what I'm doing wrong with the group layout here? Is there another layout that will function in this way, perhaps more simply?
2. I am using the grid layout to set up the mine field. It works great - except for a gap it wants to put in between the panels edge and the grid's edge. I have tried to make the panel smaller to accomodate for this gap - no matter how much smaller I make the panel, that gap remains there. Here is an image of what I'm talking about:
Anyone with experience using gridlayouts know what is wrong with my code?
Again, all of the code governing these panels is located in the big code block I posted.
I appreciate any help, this has been frustrating me for a while.