How to repaint a JPanel after have drawn on it?

前端 未结 1 805
囚心锁ツ
囚心锁ツ 2020-11-27 21:34

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

1条回答
  •  醉酒成梦
    2020-11-27 22:28

    Try calling somePanel.revalidate(). That will tell the AWT that you have changed the component tree.

    EDIT: Changed from invalidate to revalidate

    0 讨论(0)
提交回复
热议问题