All pastes #75365 Raw Edit

freeone3000

public java v1 · immutable
#75365 ·published 2006-06-30 02:51 UTC
rendered paste body
RandomMovement.java:43: cannot find symbolsymbol  : variable SwingUtiltieslocation: class RandomMovement                SwingUtilties.invokeLater(new RandomMovement());                ^1 error============================import java.awt.*;import javax.swing.*;import javax.swing.SwingUtilities;import java.util.Random;public class RandomMovement extends JPanel implements Runnable {        private static final Dimension PREFERRED_SIZE = new Dimension(100, 100);        private static final int DIVISOR = 100000;        private long lastPaint;        private Rectangle rect;        private Random r;        public RandomMovement() {                super();                lastPaint = System.nanoTime();                rect = new Rectangle(5, 5);                r = new Random(5);        }        public void run() {                JFrame f = new JFrame("Random Movement");                this.setPreferredSize(PREFERRED_SIZE);                f.setContentPane(this);                f.pack();                f.setVisible(true);        }        public void paintComponent(Graphics g) {                long tmpTime = System.nanoTime();                modifyRectangle(nextRand(), nextRand());                g.fillRect(rect.x, rect.y, rect.width, rect.height);                lastPaint = tmpTime;        }        private void modifyRectangle(int changex, int changey) {                rect.setLocation(rect.x + changex, rect.y + changey);        }        private int nextRand() {                return (int)((r.nextInt(2) - 1) * ((System.nanoTime()-lastPaint)/DIVISOR));        }        public static void main(String[] args) {                SwingUtilties.invokeLater(new RandomMovement());        }}