JPanel doesn't update when adding Component in another class

前端 未结 3 587
甜味超标
甜味超标 2020-11-29 13:43

I\'m fairly new to Java Swing and I\'m running into a few problems.

  1. As a side question, when making a fairly large Java Swing Application, what is the best wa
3条回答
  •  清歌不尽
    2020-11-29 14:16

    The problem here is the panel is not repainted automatically.. When you resize the panel Java repaints the panel on the screen. Try repainting the panel everytime any button to modify the panel is clicked..

    Just call the validate() and repaint() method with the panel

提交回复
热议问题