koma666
Mitglied
Ich hab hier ein applet mit hintergrundbild, das bild ist aber kleiner als das applet, deswegen möchte ich es kachel(wiederholt anzeigen), wenn ich das jetzt aber mit 2 schleifen mach isses sau langsam, kennt jemand ne bessere methode?
hier mein code
is natürlich nur ein fetzen der verdeutlichen soll was ich mein.
hier mein code
Code:
public void init()
{
/* bild holen */
tracker = new MediaTracker(this);
try {
adresse = this.getDocumentBase();
} catch(Exception e) {}
bild = getImage(adresse, "wabe.gif");
tracker.addImage(bild, 1);
try {
tracker.waitForAll();
} catch(InterruptedException e) {}
}
public void paint( Graphics g)
{
Graphics2D g2 = (Graphics2D)g;
for (int i = 0; i < appletwidth;i += bild.getWidth(this))
{
for (int j = 0; j < appletheigth;j += bild.getHeight(this))
{
g2.drawImage(bild, i, j, this);
}
}
}