J
JariTapio
Hei!
Im tryin to make a random screen with MemoryImageSource but faling to do
it..
I do not know what is wrong please help...
The Source follows...
Please be a friend and reply...
JariTapio/Helsinki/08may2005
www.EuroJari.com
//<applet code ="Testi.class" width=640 height=480></applet>
//
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.image.*;
public class Testi extends java.applet.Applet implements Runnable{
Thread thread;
Image image;
int [] pix = new int [999999];
public void init()
{
}
public void start()
{
thread = new Thread(this);
thread.start();
}
public void stop()
{
thread.stop();
}
public void run()
{
while ( true )
{
for (int cc=0; cc< 640*480; ++cc )
pix [cc]=(int)(Math.random ()*255);
ImageProducer ip = new MemoryImageSource ( 640,480,pix,0,640 );
image = createImage (ip);
}
}
public void paint(Graphics g)
{
g.drawImage(image,0,0,640,480,this);
}
public void update(Graphics g)
{
paint(g);
}
}
Im tryin to make a random screen with MemoryImageSource but faling to do
it..
I do not know what is wrong please help...
The Source follows...
Please be a friend and reply...
JariTapio/Helsinki/08may2005
www.EuroJari.com
//<applet code ="Testi.class" width=640 height=480></applet>
//
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.image.*;
public class Testi extends java.applet.Applet implements Runnable{
Thread thread;
Image image;
int [] pix = new int [999999];
public void init()
{
}
public void start()
{
thread = new Thread(this);
thread.start();
}
public void stop()
{
thread.stop();
}
public void run()
{
while ( true )
{
for (int cc=0; cc< 640*480; ++cc )
pix [cc]=(int)(Math.random ()*255);
ImageProducer ip = new MemoryImageSource ( 640,480,pix,0,640 );
image = createImage (ip);
}
}
public void paint(Graphics g)
{
g.drawImage(image,0,0,640,480,this);
}
public void update(Graphics g)
{
paint(g);
}
}