I have a JPanel which has GridLayout as the layout. I have a plus button at the end of the Main Panel to add some panels to the grid. I need a minus button that subsequently removes the last row added to the grid.
I saw the docs related and it shows removeAll() method, which is not useful for me as I need to remove only the last row.
Also it shows some remove(int index). Again I am unaware of the index of the last row, though I tried doing this:
myPanel.remove(0);
but this removes the first row.