接触java不久, 老师要求用swing写个简单的程序. 现在我遇到的问题:
在jpanel上面画了一个圆, 希望它能够移动, 想创造一个线程, 100ms重绘一次, 达到移动的目的, 但是编译出错, 希望能有高手看看. private class paintThread implements Runnable{
//内部类定义一个线程
        public void run() {
            throw new UnsupportedOperationException("Not supported yet.");
            while (true) {
//while(true)出错, 提示"无法访问的语句"
                repaint();
                try {
                    Thread.sleep(100);
                } catch (InterruptedException ex) {
                    Logger.getLogger(AppUI.class.getName()).log(Level.SEVERE, null, ex);
                }            }
        }    }public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AppUI().setVisible(true);
                new Thread(new paintThread()).start();//这里添加我的线程
            }
        });
    }    public AppUI() {
//这个是我的GUI, 没有任何问题        int x = 30, y = 30;
        
        initComponents();
        this.setLocationRelativeTo(null);
        Circle c = new Circle();
        c.setLocation(x,y);
        c.setSize(40, 40);       
        c.setBackground(Color.white);
        jPanel1.add(c);        x += 5;    }