Java-Simple Animation(Another Example)

Program Program Source import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class Javaapp extends Applet { public void paint(Graphics g) { int a=150,b=150,c=10,d=10; g.setColor(Color.red); for(int i=0;i<15;i++) { try{ Thread.sleep(1000); }catch(InterruptedException ex){} g.drawOval(a, b, c, d); a-=10; b-=10; c+=8; d+=8; } } }

Java-Font

Font An object of type java.awt.Font represents a font. To select a new font, first create a Font object you must supply the font name, the style of the font, and size. The setFont( ) method is used to set the font. To set the background color of an applet’s window, use setBackground( ) method. … Read more…

Java-ShowStatus

showStatus The showStatus( ) method is used to display the information in applet windows status bar of the browser or Appletviewer. This is used for debugging, because it gives you an easy way to output message. Program  Program Source import java.applet.Applet; import java.awt.Graphics; public class Javaapp extends Applet { public void paint(Graphics g) { g.drawString(“Applet started.”, 100, … 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…

Java-Init and Start

Init The init( ) method is the first method to be called. The init( ) method is called by the browser when the applet begins execution. This method is called only once during the run time of your applet. start The start( ) method is executed after the init( ) method completes its execution. This method … 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…