I have a problem with understanding how to draw more than one image in container, and how to draw animation on component. First I want to draw for example two images in on component background. here is the code:
public class CountryInteriorContainer extends Component {
private PainterChain backgroundPainterChain;
public CountryInteriorContainer () {
super();
backgroundPainterChain = new BackgroundPainterChain(new GroundPainter("CountryBackgroundLand"));
backgroundPainterChain.addPainter(new CastlePainter("CastleBrown"));
getStyle().setBgPainter(backgroundPainterChain);
}
}
Here I`m creating painting queue. But there is only one first image on draw on container.
public class CastlePainter extends BasePainter {
public CastlePainter(String imageId) {
super(imageId);
}
public CastlePainter(Image image) {
super(image);
}
public void paint(Graphics g, Rectangle rect) {
g.drawImage(getImage(), rect.getX() + 40, rect.getY());
}
}
BasePainter just initializing image from cache or resources.
Please help me somebody to understand why only first painter works fine. And also how to create animation melodramatically in LWuiT.