posted 22 years ago
I thought it might be more helpful if I just let you all see the code and find out why the image in Canvas isn't displaying on the screen.
public void init() {
leftBoardWalk = getImage(getCodeBase(),"leftBoardWalk.gif");
}
public void start() {
...
DisplayImage leftBoardWalkDisplayImage = new DisplayImage(leftBoardWalk);
...
Panel mainStartPanel = new Panel();
mainStartPanel.setLayout(new BorderLayout());
...
mainStartPanel.add(leftBoardWalkDisplayImage,BorderLayout.WEST);
...
}
class DisplayImage extends Canvas {
Image image ;
public DisplayImage(Image image) {
setBackground(Color.white);
this.image = image;
}
public void paint(Graphics g) {
update(g);
}
public void update(Graphics g) {
g.drawImage(image,0,0,this);
}
}