Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Image refresh based to timer (http://www.velocityreviews.com/forums/t151895-image-refresh-based-to-timer.html)

mikap79@hotmail.com 04-06-2006 05:52 PM

Image refresh based to timer
 
Hi

I'm new with Java. My problem is how to refresh image on applet canvas
based on timer.
How to repaint canvas every 5sec by using Java.util timer?

Thanks,

-Mike


package untitled7;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.awt.image.*;




public class Applet1 extends Applet {
Image myimage=null;


boolean isStandalone = false;
BorderLayout borderLayout1 = new BorderLayout();

//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}

//Construct the applet
public Applet1() {

}

//Initialize the applet
public void init() {
try {
jbInit();

} catch (Exception e) {
e.printStackTrace();
}
}


public void paint(Graphics g) {

myimage = getImage(getCodeBase(),"logo.gif");

g.drawImage(myimage, 10, 10, this);
}

//Component initialization
private void jbInit() throws Exception {
}

//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}

//Get parameter info
public String[][] getParameterInfo() {

return null;
}
}


Oliver Wong 04-06-2006 07:10 PM

Re: Image refresh based to timer
 

<mikap79@hotmail.com> wrote in message
news:1142959065.520484.99950@g10g2000cwb.googlegro ups.com...
> Hi
>
> I'm new with Java. My problem is how to refresh image on applet canvas
> based on timer.
> How to repaint canvas every 5sec by using Java.util timer?
>
> Thanks,


There's a tutorial at
http://java.sun.com/docs/books/tutor...ts/applet.html

- Oliver



All times are GMT. The time now is 05:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.