Results 1 to 3 of 3
Thread: Expandable Grid Panel
- 08-22-2009, 02:11 PM #1
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.
- 08-23-2009, 11:53 AM #3
- By leoleo4614 in forum AWT / SwingReplies: 1Last Post: 12-13-2008, 08:02 AM
- By Nakira in forum New To JavaReplies: 7Last Post: 11-14-2008, 07:49 PM
- By Nakira in forum New To JavaReplies: 11Last Post: 11-12-2008, 11:45 AM
- By jazz2k8 in forum Advanced JavaReplies: 2Last Post: 11-06-2008, 03:11 PM
- By coco in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 09:03 PM