removeAll not removing at next validate?

前端 未结 3 1913
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 08:06

Can someone explain why the following doesn\'t work as I expect?

Pressing the button \'should\' result in the display only containing the (empty) JScrollPane, ie the

3条回答
  •  有刺的猬
    2020-11-27 08:38

    When updating a visible GUI the code should be:

    panel.revalidate();
    panel.repaint(); // sometimes needed, this appears to be one of them
    

提交回复
热议问题