JLabel setText not updating text

前端 未结 5 1816
日久生厌
日久生厌 2020-12-21 16:44

I am trying to update a JLabel by using the setText() method, but I can\'t redraw JLabel. Do I have to use the repaint() method to do that?

5条回答
  •  死守一世寂寞
    2020-12-21 17:05

    repaint() won't work here.

    Simply use label_name.paintImmediately(label_name.getVisibleRect());

    It will get updated right away.

提交回复
热议问题