/**
* @(#)Schachbrett.java
*
* Sample Applet application
*
* @author
* @version 1.00 04/05/06
*/
import java.awt.*;
import java.applet.*;
public class Schachbrett extends Applet {
public void init() {
}
public void paint(Graphics g)
{
g.setColor(Color.white);
g.fillRect(50, 50, 160, 160);
g.setColor(Color.black);
int a=50;
int s=50;
int d=20;
int f=70;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a, s, d, d);
s=s+40;
}
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+20, f, d, d);
f=f+40;
}
s=50;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+40, s, d, d);
s=s+40;
}
f=70;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+60, f, d, d);
f=f+40;
}
s=50;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+80, s, d, d);
s=s+40;
}
f=70;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+100, f, d, d);
f=f+40;
}
s=50;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+120, s, d, d);
s=s+40;
}
f=70;
for (int i=0; i<4; i=i+1)
{
g.fillRect(a+140, f, d, d);
f=f+40;
}
}
}
Naja, STRG+C, STRG+V, F9 und fertig.L-ectron-X hat gesagt.:@Illuvatar: Danke, dass Du den Code schon getestet hast, so war es für mich nun leichter.
java.lang.ClassNotFoundException: Schachbrett.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes\Schachbrett\class.class (Das System kann den angegebenen Pfad nicht finden)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
javac Schachbrett.java
und erst dann:
appletviewer Schachbrett.html
Error : Invalid path, c:programme\sun\bin\javac.exe -classpath "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes" -d "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes" "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes\Schachbrett.htm"
Process completed.
chillman hat gesagt.:habs gerade versucht, kommt jedoch ein error
Code:Error : Invalid path, c:programme\sun\bin\javac.exe -classpath "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes" -d "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes" "C:\Programme\Xinox Software\JCreatorV3 LE\MyProjects\Schachbrett\classes\Schachbrett.htm" Process completed.