Hoops !
> try to update your copy of the waba CVS and test the attached example ?
Here is the attached example. Sorry.
Olivier
--
Olivier Bornet SMARTDATA SA
[EMAIL PROTECTED] Centre du Parc
http://www.smartdata.ch av. des Pr�s-Beudin 20
Phone +41-27-723'55'03 1920 Martigny
Fax +41-27-723'55'19 Phone +41-27-723'55'18
import waba.ui.*;
import waba.fx.*;
import waba.sys.*;
import waba.sys.VmShell;
public class testTimer extends MainWindow {
static final int TIMER_VALUE = 10;
Graphics drawg = new Graphics(this);
Font plainFont = new Font("Helvetica", Font.PLAIN, 12);
// for the animated image
Image image = new Image(20, 20);
boolean inErase = false;
int imageX, imageY, maxImageX, maxImageY, stepX, stepY;
Timer timer;
public testTimer() {
initImage();
timer = addTimer(TIMER_VALUE);
}
public void onEvent( Event event ) {
if (event.type == PenEvent.PEN_DOWN) {
repaint();
} else if (event.type == ControlEvent.TIMER) {
animateImage();
animateImage();
}
}
private void initImage() {
// defaults for the animated image
imageX = 0;
imageY = 0;
maxImageX = this.width - 20;
maxImageY = this.height - 20;
stepX = 8;
stepY = 0;
// draw into the animated image
Graphics ig = new Graphics(image);
ig.setColor(100, 0, 0);
ig.fillRect(0, 0, 20, 20);
ig.setColor(255, 255, 255);
ig.fillRect(4, 4, 12, 12);
ig.setColor(0, 0, 0);
ig.fillRect(6, 6, 8, 8);
}
private void animateImage() {
imageX += stepX;
imageY += stepY;
if (imageX < 0)
{
stepY = -8;
stepX = 0;
imageX = 0;
}
else if (imageX > maxImageX)
{
stepY = 8;
stepX = 0;
imageX = maxImageX;
}
if (imageY < 0)
{
stepX = 8;
stepY = 0;
imageY = 0;
inErase = !inErase;
}
else if (imageY > maxImageY)
{
stepX = -8;
stepY = 0;
imageY = maxImageY;
}
if (!inErase)
drawg.drawImage(image, imageX, imageY);
else
{
drawg.setColor(255, 255, 255);
drawg.fillRect(imageX, imageY, 20, 20);
}
}
public void onPaint(Graphics g) {
VmShell.println( "coucou\n" );
}
}