"Start: Applet not initialized" help [message #730206] |
Tue, 27 September 2011 21:41 |
inga Messages: 1 Registered: September 2011 |
Junior Member |
|
|
I am trying to run this program. At school I usually run it as a Java Applet, but at home I do not see that option under run. I am using eclipse. A white screen pops up that says at the bottom "Start: applet not initialized." And in console it says "load: class .class not found.
java.lang.ClassNotFoundException: .class
at sun.applet.AppletClassLoader.findClass(U... Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(U... Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Un... Source)
at sun.applet.AppletPanel.createApplet(Unkn... Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
"
This is the only code i have so far and it usually draws something: import turtlegraphics.TurtleException;
import java.applet.*;
import java.awt.*;
public class Test extends JApplet {
public static void main(String[] args) {
SmartTurtle tippy = new SmartTurtle();
try {
tippy.turn(-90);
tippy.drawSegment(4, 600);
} catch (TurtleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
NEXT CLASS
import turtlegraphics.Turtle;
import turtlegraphics.TurtleException;
/**
* SmartTurtle is an extension of Turtle.
* @author 12
* @version September, 2011
*
*/
public class SmartTurtle extends Turtle{
public void drawStar(int numberOfSpikes, int spikeLength) throws TurtleException {
int k = 0;
while (k < numberOfSpikes) {
this.move(spikeLength);
this.turnRight(180);
this.move(spikeLength);
this.turnRight(180);
this.turn(360 / numberOfSpikes);
k++;
}
}
/*
for (int j = 0; j < numberOfSpikes; j++) {
this.move(spikeLength);
this.turnRight(180);
this.move(spikeLength);
this.turnRight(180);
this.turn(360 / numberOfSpikes);
}
}
*/
public void drawRegularPolygon(int numSides, int sideLength) throws TurtleException {
for (int k = 0; k < numSides; k++){
this.turn(((360 / numSides)));
this.move(sideLength);
}
}
public void drawSquare(int sideLength) throws TurtleException {
for (int k = 0; k < 4; k++) {
this.move(sideLength);
this.turnRight(90);
}
}
public void drawSegment(int pointiness, int length) throws TurtleException{
if (pointiness == 0) {
this.move(length);
}
else {
this.drawSegment(pointiness - 1, length / 3);
this.turnLeft(60);
this.drawSegment(pointiness - 1, length / 3);
this.turnRight(120);
this.drawSegment(pointiness - 1, length / 3);
this.turnLeft(60);
this.drawSegment(pointiness - 1, length / 3);
}
}
/**
* turns this SmartTurtle <code>degrees</code>
* degrees (counterclockwise) if <code>degrees</code> <0
* degrees (clockwise) if <code>degrees</code> >0
* @param degrees the number of degrees to turn.
* @throws TurtleException
*/
public void turn(int degrees) throws TurtleException {
int posDegrees = Math.abs(degrees);
if (posDegrees % 360 == 0) return;
int num180;
int remainder180;
num180 = posDegrees / 180;
remainder180 = posDegrees % 180;
if (num180 % 2 != 0) {
this.turnRight(180);
}
if (degrees < 0) {
this.turnRight(remainder180);
}
else {
this.turnLeft(remainder180);
}
}
/**
* Turns this SmartTurtle left <code>degrees</code> degrees
* @param degrees the number of degrees to turn
* @throws TurtleException if <code>degrees</codes> <0 or >180.
*/
public void turnLeft(int degrees) throws TurtleException {
this.turnRight(180);
this.turnRight(180 - degrees);
}
}
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.03423 seconds