I’ve got frame with two JPanels on it in GridLayout :
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400,400);
contentPane = new JPanel();
contentPane.setLayout(new GridLayout(1,2));
contentPane.add(addPanel());
contentPane.add(addPanel());
add(contentPane);
addPanel() function create JPanel with random colors. When I move mouse cursor on the line between this two panels, I would like to be able to resize dynamically that panels. One becomes wider, and second thiner. How do manage it?
You can use a
JSplitPane.