Expandable Grid Panel
I'm looking to create a JPanel with a GridLayout, except I want to control-click one of the grid cells in the panel and have it expand to fill the entire panel (then when I do the same again, it should return to the grid view). I can see me having to create a custom layout/control, but I just wondered if anybody has done this type of thing before?
It can be done probably in several ways. One is to put all the grid panels in a JPanel that uses GridLayout, then add this to a main JPanel that uses borderlayout. When a grid panel is clicked swap the gridlayoutpanel for the single panel and call revalidate and repaint. Then if ctrl-clicked again, remove all from the gridlayout panel and then re-add the panels (don't do this and it will have a gap due to the panel that was removed from the grid and shown in the main panel). Then add the gridlayout panel to the main panel, borderlayout.center, and again revalidate and repaint.
Play with it, and you'll likely get it to work out.
Thankyou Fubarable, looks like great minds think alike! I coded a solution yesterday and that's exactly what I did! :D