Chant
Posts: 5
Nickname: meridian
Registered: Jun, 2002
|
|
draw
|
Posted: Jun 21, 2002 8:16 PM
|
|
Advertisement
|
can someone tell me why this simple code isn't working? there's a double buffer but i haven't added the threading yet:
import javax.swing.*; import java.awt.*;
public class Shapes extends JApplet {
private final Dimension wh; private Image backImage; private Graphics backGraphics;
public void init() {
wh = getSize();
}
public void paint(Graphics g) {
backImage = createImage(wh.width, wh.height); backGraphics = backImage.getGraphics();
backGraphics.setColor(Color.black); backGraphics.fillRect(0, 0, wh.width, wh.height); backGraphics.setColor(Color.red); backGraphics.fillOval(300, 300, 50, 50); backGraphics.setColor(Color.green); backGraphics.fillOval(310, 310, 5, 5);
g.drawImage(backImage, 0, 0, this);
}
}
|
|