Repainting Continuously in Java

后端 未结 4 1761
南旧
南旧 2021-01-16 07:09

I have a Java program that uses threads. In my run method, I have:

public void run() {
    while(thread != null){
        repaint();
        System.out.print         


        
4条回答
  •  天涯浪人
    2021-01-16 07:43

    You have to call paint(g) for a heavy-weight container such as a JFrame. You call paintComponent(g) for light-weight containers like a JButton. See if that works.

提交回复
热议问题