Prevent Java from repainting the content of a JPanel while updating

后端 未结 3 1053
暗喜
暗喜 2020-12-12 04:10

I have a JPanel which contains a lot of child components. While updating\\adding new components to the parent JPanel I\'d like to prevent it from repainting, how can this ac

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 04:49

    you could try by using setIgnoreRepaint(boolean value) but it's a typical swing feature that can or cannot work (mainly because it depends from AWT so you never know).

    Otherwise you could override the paint method by using a flag that simply makes the methor return without calling super.paint(). (actually overriding paintComponent should be the right choice)

提交回复
热议问题