NiceButDim
Programmer
Hi, I am very new to Java. I have a problem with displaying an image;
-------------------------------
package bts;
import java.applet.*;
import java.awt.*;
public class Match extends Applet {
Image box;
public void init() {
prepare();
}
public void prepare() {
box = createImage(700,100);
Graphics g = box.getGraphics();
g.setColor(Color.RED);
g.fillRect(0,0, 700,100);
}
public void paint(Graphics g) {
g.drawImage(box,10,10,this);
}
}
-------------------------------
This code simply draws a red rectangle on the top left of my browser. That works fine. However, if I then drag another window over my rectangle, it is not always redrawn.
Can anyone explain what I am doing wrong.
Thanks.
john.
-------------------------------
package bts;
import java.applet.*;
import java.awt.*;
public class Match extends Applet {
Image box;
public void init() {
prepare();
}
public void prepare() {
box = createImage(700,100);
Graphics g = box.getGraphics();
g.setColor(Color.RED);
g.fillRect(0,0, 700,100);
}
public void paint(Graphics g) {
g.drawImage(box,10,10,this);
}
}
-------------------------------
This code simply draws a red rectangle on the top left of my browser. That works fine. However, if I then drag another window over my rectangle, it is not always redrawn.
Can anyone explain what I am doing wrong.
Thanks.
john.