Java-Text Moving Animation

Program Program Source import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; import java.awt.Font; public class Javaapp extends Applet implements Runnable{ private String msg = “123456789”; private Thread t; public void start() { t = new Thread(this,”Animation”); t.start(); } public void run() { for(;;) { try{ Thread.sleep(2000); }catch(InterruptedException ex){} msg +=msg.charAt(0); msg = msg.substring(1,msg.length()); repaint(); } } public … Read more…

Java-Repeated Execution of Start and Paint

Repeated Execution of Start and Paint The init() method to be executed only once. But the start() method called every time whenever the execution of an applet is to be resumed. Program Prorgam Source import java.applet.Applet; import java.awt.Graphics; public class Javaapp extends Applet { String str = “”; public void init() { str+=”-init-“; } public void … Read more…

Java-Repeated Execution of Paint

Repeated Execution of Paint The paint( ) method is automatically called by the appletviewer or the web browser whenever the applet needs to be refreshed. The paint method is called each time of your applet’s must be redrawn. For example the applet window is minimized and then maximized, paint( ) is also called when the … Read more…