I have three panels inside one panel(which is inside JFrame).In the middle panel there are some 30 JButtons.Now I want to add JButton dynamically inside the middle panel on click of a leftmost panel JButton.I am doing following
imagePanel.add(newBtn);
imagePanel.revalidate();
outermostPanel.revalidate();
But,on doing this nothing happens.I don't want to use repaint as I will re-draw the complete middle panel and I am only left the new JButton,the previously added 30 JButtons are gone.