Hallo
Ich habe für donnrstgas ha auf und hab ken plan wie
ich muss e schachbrett male mit drawrect
aber es geht net imgeringsten ich krieg nur ein rotes X oben im html file
quell java datei
quell für html file
<html>
<head>
</head>
<body>
<applet code="Schachbrett.class" width = "600" height = "600">
</applet>
</body>
</html>
bin für jede hilfe dankbar
Ich habe für donnrstgas ha auf und hab ken plan wie
ich muss e schachbrett male mit drawrect
aber es geht net imgeringsten ich krieg nur ein rotes X oben im html file
quell java datei
Code:
import java.awt.*;
import java.applet.*;
import java.*;
public class Schachbrett extends java.applet.Applet
{
int iHoehe;
int iLaenge;
int xPos;
int yPos;
boolean schwarz;
public void init( ) {
iHoehe = 20;
iLaenge = 20;
xPos = 0;
yPos = 0;
schwarz = true;
}
public void paint(Graphics g)
{
for (int i = 1; i <= 8; i++)
{
for(int j = 1; j <= 8; j++)
{
if (schwarz == true)
{
g.setColor(Color.black);
g.drawRect(xPos,yPos,iHoehe,iLaenge);
schwarz = false;
xPos = xPos + 20;
}
else
{
g.setColor(Color.white);
g.drawRect(xPos,yPos,iHoehe,iLaenge);
schwarz = true;
xPos = xPos + 20;
}
}
xPos = 0;
yPos = yPos + 20;
}
}
}
<html>
<head>
</head>
<body>
<applet code="Schachbrett.class" width = "600" height = "600">
</applet>
</body>
</html>
bin für jede hilfe dankbar
Zuletzt bearbeitet von einem Moderator: