0
エラー:class、interfaceまたはenumがありません
java初心者です。
コンパイルエラー: class、interfaceまたはenumがありません
import java.awt.*; と出てしまって困っています。
^
どこを直したら良いか教えて下さいm(__)m
import java.applet.*;
import java.awt.*;
public class Animation2 extends Applet {
MyThread thread = null;
int radius, x, y, width, move;
Circle circle;
public void init() {
width = getSize().width;
radius = 25;
x = 0 + radius;
y = 50 + radius;
move = 10;
circle = new Circle1(radius);
circle.setXY(x, y);
circle.setSpeed(move);
circle.setColor(color[i]);
circle.setMovingWidth(width);
Color color [] = {Color.red, Color.pink, Color.magenta, Color.cyan};
int i = (int)(Math.randam() * color.length);
}
public void start() {
if(thread == null) {
thread = new MyThread();
thread.start();
}
}
public void stop() {
thread = null;
}
public void paint(Graphics g) {
circle.setColor(color[i]);
circle.paint(g);
}
class MyThread extends Thread {
public void run() {
Thread thisThread = Thread.currentThread();
while(thread == thisThread) {
repaint();
circle.nextPlace();
try{
thread.sleep(200);
} catch(InterruptedException e) {
}
}
}
}
}
import java.awt.*;
public class Circle {
int i = 0;
int radius = 0;
int x = 0;
int y = 0;
int move = 0;
int width = 0;
Color color = Color.red;
Circle(int radius) {
this.radius = radius;
}
public void setXY(int x, int y) {
this.x = x;
this.y = y;
}
public void setSpeed(int move) {
this.move = move;
}
public void setMovingWidth(int width) {
this.width = width;
}
public void setColor(Color color) {
this.color = color;
}
public void paint(Graphics g) {
circle.setColor(color[i]);
g.fillOval(x - radius, y - radius, 2 * radius, 2 * radius);
}
public void nextPlace() {
setXY(x + move, y);
if ( x >= (width + radius)) {
setXY(x - width, y);
}
}
}