I'm implementing a GUI for a game (Qwirkle) which does not have a fixed board size. It dynamically grows when placing tiles next to another tile (with same color or shape).
Basically, I have an x,y-plane which grows dynamically when placing tiles. I have a function which gives the the bounds in an array[4] (left, top, right, bottom) such that I know what I have to display in the GUI.
Now I'm looking for a way to update the GUI's x,y-plane everytime new tiles are placed. Every tile is represented as a button and can be selected when the button is empty (meaning the empty tile, or no tile).
So if a tile (x,y) is placed ((0,0) initially), I want a x,y-plane with from -1 to 1 (fot both x and y). Then when a tile is placed on (1,0), the (x,y)-plane should be updated with new bounds. Preferably buttons should be a square (so a GridLayout might not be a good option?). So I have a fixed Jpanel in which the x,y-plane is centered and expands dynamically.
Any ideas how to display such a game?