Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Here Is Solution for Flick Free Applet.

843807Jun 18 2004 — edited Jun 21 2004
check these links to find solutoin for Flick Free Applet

http://www.dgp.toronto.edu/~mjmcguff/learn/java/07-backbuffer/
http://library.thinkquest.org/17862/srcvmarq.htm
http://forum.java.sun.com/thread.jsp?forum=31&thread=525743
-------------------------------------------------------------

i have created an Applet which works fine in JVM but when i run it on MVM in IE 6
it still flicks, pls help me to run my applet in MVM

import java.awt.*; import java.util.*; import java.applet.*; import java.net.*;
public class noflicker extends Applet implements Runnable
{
boolean b;
Thread t;
int x=0;
Image image,imgBuffer;
Graphics grpBuffer;
public void init()
{
setBackground(Color.white);
try
{
image = getImage(new URL(getCodeBase() +"/myimage.jpg"));
}
catch(MalformedURLException me)
{
System.out.println(me);
}
MediaTracker mt = new MediaTracker(this);
mt.addImage(image,1);
try
{
mt.waitForAll();
}
catch(Exception e)
{
System.out.println(e);
}
image = image.getScaledInstance(200,100,Image.SCALE_DEFAULT);
}
public void start()
{
imgBuffer = createImage(210,100);
grpBuffer = imgBuffer.getGraphics();

b = true;
t = new Thread(this);
t.start();
}
public void paint(Graphics g)
{
grpBuffer.drawImage(image,10,0,this);
g.drawImage(imgBuffer,x,10,this);
}


public void update(Graphics g)
{
paint(g);
}

public void run()
{
while(b)
{
repaint();
x++;
if(x>600)
x=0;
try
{
Thread.sleep(5);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
public void stop()
{
b=false;
if(t!=null)
{
t=null;
}
}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2004
Added on Jun 18 2004
5 comments
181 views