Skip to content

Making a JPanel manually resizable

I have a JFrame with BorderLayout as the layout manager.

In the south border, I have a JPanel, I want this JPanel‘s size to be adjustable by the user, i.e. the user can click on the edge of the border and drag it up to make it larger.

Is there any way you know that I can do this?



In order to make panels in a frame individually resizable you need to add them onto a JSplitPane.

Instead of putting it in the South portion of the Frame, put the JSplitPane in the Center. The split pane will make the bottom panel in the split seem like it is in the South, and the top panel in the split will be in the Center of the frame.

Make sure you set the orientation of the two panels with setOrientation(JSplitPane.VERTICAL_SPLIT ).

Then, you can resize the panels that are in the pane.