within a java chess application, I need at different points in time to “invert” the GridLayout representing the board. (after the turn of White/Black for example, or simply at the user’s request to get a different view of the board).
Is there any quick way invert vertically a GridLayout ? That would enable me to not have to unload and reload background squares, and that would make my click events easier to handle as panels don’t get moved around.
Unfortunately there is no built-in functionality for flipping a GridLayout in swing. Instead, you could try removing the panels that make up your board and re-adding them in reverse order. This would essentially “flip” the board.