I have a component that inherits from JPanel, I draw a grid on it. Now I have a JComboBox and I want the user to be able to choose the grid size here and then press a button
Try calling somePanel.revalidate(). That will tell the AWT that you have changed the component tree.
somePanel.revalidate()
EDIT: Changed from invalidate to revalidate
invalidate
revalidate