How Can I Create a Simple Grid with a GridLayout?
I'm trying to create a work schedule using two nested loops and which I'd like to look like an MS Word table (or Excel document). It must be designed in such a way that the inside of the squares can be used to clic in via events and listeners (I don't know how to do this yet, so please bear with me, for the time being I'm working on the graphics part only...). I'm having problems creating a simple grid with simple black lines (borders, like an MS Word table) and choosing the dimensions I want. I don't imagine that it is all that difficult, but I just can't figure it out!
I'd like the inside of the squares to be components (I think this is a good idea!? JPanels??)... Actually, I don't quite know how to organize all of this, to tell you the truth.
This whole thing will be the main part of a window, there will be other components in the window as well (buttons, etc.).
Ah, which reminds me, the other thing I don't know how to do is to write text in the window but to have it surrounded by a border (square/rectangle) to display information about a worker or a shift.
In my method, I suppose that the dimensions of the main grid or table could correspond to, for example, from left to right, the number of days of the week (Mon, Tue, Wed, etc.), from top to bottom the number of workers of a company, and inside we could put work shifts (morning shift, afternoon shift, night shift, etc).
Eventually, I'd like to be able to click on buttons and then onto the appropriate square to assign a shift to a give slot (person and day). (Once again, I'm not sure how to do this yet, I'm just working on the graphics part for the time being).
I was thinking of using a GridLayout, but would be open to other suggestions if it will make things easier.
So, to sum up, two things, a grid and a text surrounded by a border (square/rectangle) to display information.
Could someone give me a few lines of code that will make this happen?